iOS-14 netServiceBrowser.searchForServices Not working - swift

Recently i updated my phone to iOS 14 and since then netServiceBrowser.searchForServices(ofType:"xyz._tcp", inDomain: "local.") not working at all. iPhone is not able to discover any services and not calling any NetServiceBrowserDelegate methods.

Your app requires access to the local network, and iOS14 has a new privacy option that requires authorization for this.
You have to add NSLocalNetworkUsageDescription to your Info.plist, see apple docs

If you use Bonjour, you need to déclare it in info.plist too...
<key>NSBonjourServices</key>
<array>
<string>_http._tcp</string>
</array>

here is my solutions that work for me well
<key>NSLocalNetworkUsageDescription</key>
<string>Allow Flutter tools on your computer to connect and debug app</string>
<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>

Related

The app closes instantly when launching from custom scheme url - flutter - uni_links

I'm using custom scheme and am testing
on my iPhone6, iOS Simulator
which is running iOS 15
the app works fine when I launch it from https (Universal Link)
but when I try to launch it using Custom URL scheme it crashes instantly, dosent reach the main function ether.
Am sure you'll need to register your schemes here if I answered your question;
I have some examples below.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
<string>mailto</string>
<string>tel</string>
<string>facetime</string>
<string>sms</string>
</array>

This app is not allowed to query for scheme XYZ://

You might think it's a duplicate question, but it's not, I'm totally aware of all the answers on SO about the canOpenURL and its caveats on iOS 9, but here is my problem:
I'm trying to check if an specific app is installed on my device (both developed by me).
I have declared the scheme on AppA as:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.my.company.id</string>
<key>CFBundleURLSchemes</key>
<array>
<string>XYZ</string>
</array>
</dict>
</array>
and on the other app, AppB I have added in info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>XYZ</string>
</array>
Now, in AppB I'm trying to find out if I have AppA installed like this:
internal static let appAScheme = "XYZ://"
static func AppAInstalled() -> Bool {
let appAURL = NSURL(string: appAScheme)
return UIApplication.sharedApplication().canOpenURL(appAURL!)
}
It always returns
-canOpenURL: failed for URL: "XYZ://" - error: "This app is not
allowed to query for scheme XYZ"
How ever, If I try to open AppA from AppB it'll work with no problem!
// Works alright
UIApplication.sharedApplication().openURL(appAURL!)
I can't figure it out why!
I have found the solution to my own question. I'm answering it here instead of just deleting my question because it might help somebody someday.
The problem here was that I'm trying to develop a framework for other developers, I have a test app that I'm using to check if everything is fine with my framework. I was setting LSApplicationQueriesSchemes values inside the framework target, not the actual test app. SO:
You need to set the whitelist values in your app target's info.plist

getting error in DropBox integration to the iphone app

I am trying to integrate the DropBox to my iPhone app. But I get error like
[ERROR] DropboxSDK: unable to link; app isn't registered for correct URL scheme (db-xpt9oxj57x9ftci)
Can anyone help me to solve this?
Most of the time that problem is caused by a misconfigured Info.plist file. Can you make sure you've followed the documentation/index.html about changing Info.plist file? In info plist set db-key in urltype (urlschema). That should do the trick.
I googled and the Dropbox sdk has the line specifically to add the the app key in your app plist file
Your app key is also needed in DBRoulette-Info.plist file so the app
can register for the correct url scheme. To do this, find the file
under the Resources group in the left pane, right-click it and select
Open As → Source Code. Replace the text APP_KEY with your app's key
https://www.dropbox.com/developers/start/setup#ios
I found this solution.
I am working with Xamarin in Windows Visual Studio 2015, and as presented in other queries online, there is no "URL scheme" option available. So the solution is to modify info.plist by hand. Your dropbox specific plist scheme should look like this:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-2</string>
<string>dbapi-8-emm</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>db-APP_KEY</string>
</array>
</dict>
</array>
A great helper for me to get this information was the "info.plist" for this. This "info" modification should work for any xamarin project.
If you fix any typos or forget the "db" and are still having problems, clean & rebuild may help.
Your URL scheme should be db-<Your App key>. Example db-a7ghdtthegj6z1g
I had this issue just now and was done in by a space before the db- prefix. Hard to see in the plist editor, but very obvious when I looked at the XML.

distribution provisioning and code signing issues

I just generated a ad hoc distribution provisioning. I dragged this into xcode and then set my ad hoc build to be iphone distribution. Followed every single step in this tutorial. The issue is that when I follow this instruction to see my list of devices it doesn't even have a ProvisionedDevices key in the embedded.mobileprovison. The key goes something like this:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>8CH38P5X6X.*</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>8CH38P5X6X.*</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2012-03-17T00:31:45Z</date>
<key>Name</key>
<string>Fever</string> //this is not my app name, how come it's here
<key>TimeToLive</key>
<integer>291</integer>
<key>UUID</key>
<string>101F3A06-B33C-411A-8173-A4CEAFF5E673</string>
<key>Version</key>
<string>101F3A06-B33C-411A-8173-A4CEAFF5E673</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>
The weirdest issue is that it has an app name in the , which is not my app name!! How is this even possible? Something is messed up..
This 8CH38P5X6X is also the App ID of my other app called Fever... how.. how is this possible. I've code signed adhoc using iphone distribution and it clearly says this:
UPDATE:
I removed/clear the provisioning profile that I have for the Fever app, restart xcode, and tried to build the archive again and it works! Anyone ever have issues with multiple provisioning profile on your xcode being mixed up like this?
If anyone is having such issues, please delete all other distribution provisioning profile you have on your system.

Lock-down iPhone/iPod/iPad so it can only run one app

We'd like to 'lock-down' an iPhone/iPod/iPad so that the user can only run one app (we've developed this app internally). I'm guessing we'd be looking at jailbreaking, and then replacing (?) the default Springboard app.
Can we do this? If so, how?
EDIT: iOS 7 now includes an 'App Lock' payload as part of the device configuration profile. From the Apple docs:
"By installing an app lock payload, the device is locked to a single application until the payload is removed. The home button is disabled, and the device returns to the specified application automatically upon wake or reboot."
Read more about it here:
https://developer.apple.com/business/documentation/Configuration-Profile-Reference.pdf
It is possible to put an iPad or iPhone into 'Store Demo' mode so that the home button and swipe to home gesture is disabled. If you have seen the iPads in the Apple Store running the smart sign apps then you will know what I mean.
It is actually pretty trivial to make this work, all you need to do is install a correctly formatted mobile config plist over the air from a web server.
To deliver your config from the web all you have to do is direct the iPhone to a url containing the profile. Just open the link to your .mobileconfig file in safari. If you don't have web space you can just use dropbox public folder URLs or switch on your mac webserver.
It's possible that you can load the config using IPCU too but I have not tried this. This config file will not load in the iPhone Configuration Utility as it uses keys that IPCU doesn't know about. You can combine this with whatever other enterprise configuration profiles you have in play.
EDIT: #cocoanetics pointed out that IPCU is not required to remove the profile. However note that to get your device back to normal you would need to do the following:
Reboot
Open the settings app FIRST - don't open anything else or you will need to reboot again
Settings->General->Profiles->[your profile] remove it.
Reboot
you should be back to normal.
I have included an example plist that will disable the home button and lock your device into the app.
BEWARE
Once this profile is installed the first app that is launched when the device is rebooted will be the only app that will run until you reboot the device again.
As #Cawas has said this completely disables the ability to return to the home screen (unless your app crashes) including accessibility assistive touch.
Note that after installing the profile you must reboot the device (power off, power on) for it to take effect. To remove the profile plug the device into IPCU and delete it then reboot the device. Everything will be back to normal.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Disables home</string>
<key>PayloadDisplayName</key>
<string>Home Button Lock</string>
<key>PayloadIdentifier</key>
<string>com.hbkill.kiosk</string>
<key>PayloadOrganization</key>
<string>My Org</string>
<key>PayloadType</key>
<string>com.apple.defaults.managed</string>
<key>PayloadUUID</key>
<string>B2D02E2D-BAC5-431B-8A29-4B91F71C9FC1</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadContent</key>
<array>
<dict>
<key>DefaultsDomainName</key>
<string>com.apple.springboard</string>
<key>DefaultsData</key>
<dict>
<key>SBStoreDemoAppLock</key>
<true/>
</dict>
</dict>
</array>
</dict>
</array>
<key>PayloadDescription</key>
<string>Disables Home Button</string>
<key>PayloadDisplayName</key>
<string>Home Button Lock</string>
<key>PayloadIdentifier</key>
<string>com.hbkill</string>
<key>PayloadOrganization</key>
<string>My Org</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>614D1FE3-F80D-4643-AF6B-D10C4CC8737A</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>
You may well have moved on from this but I thought I would post this answer here as I came across the question while I was trying to figure out how to do the same thing.
This is a feature of iOS 6 that can be used without hacky attempts. It's called 'guided access'. I small tutorial is here.
EDIT: In case the device's battery runs empty while it's in the hands of a restricted user, the user could reload the device and it will reboot without guided access. However, if you choose to use a password for the device, this shouldn't be a problem.
An alternative to the (admittedly much simpler) approach described by Rick is to:
disable the home button (e.g. physically covering it),
disable the five-finger gesture and screen lock in the Settings, and
install a “Trampoline” to relaunch the app should it crash.
http://www.apple.com/support/ipad/enterprise/
Apple provides enterprise configuration tools which allow control over which applications are permitted etc. This is done through profile management it seems. See link for more details
I agree with a comment from some hours ago: Settings > General > Restrictions should do the trick. If the user can't install anything, can't access Safari or Mail, then there is no reason to ever quit your app.
Block internet access from device (MAC-filter on wi-fi can do the trick). Any other non-internet related problem (music, games, etc) should already be solvable by the current IT infrastructure (unless your developers plays and listen to MP3 at work).
i found one way to quit this home-lock state.
i have install "backgrounder" via cydia which make your app run in background if you press home button for one second or more.
and now, when i longpress home button, i back to the home screen.
that is all.
pay attention on longpress.
Um- wasn't sure if this is an answer or a comment but - the solution that is now part of the question has a weakness - our support staff used this and found that if you "Tap the power button to ‘soft-off’ then hold the home button as you power on and slide to unlock. Sometimes iPad will start on the home page or else XXAPPLCATIONXX will hang and then drop out to the home page. Eitherway X is able to access the home page without the passcode."