openURL fails with Settings Scheme - ios

I'm trying to add a button to quickly access the iCloud Keychain. I'm aware that it isn't allowed on the App Store.
Based on this article I found the preferred deep link for iOS Settings > Passwords,
prefs:root=PASSWORDS&search=$query. I added the prefs value to my "Queried URL Schemes" in info.plist as well.
Despite this, the app fails to open my URL and throws this error:
Failed to open URL prefs:root=PASSWORDS: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=244, _LSFunction=-[_LSDOpenClient openURL:fileHandle:options:completionHandler:]}
This error is given when omitting the "search" parameter too.
Any idea on how I can accomplish this?

Related

How to check if an iOS app is installed without canOpenURL [duplicate]

This question already has answers here:
canOpenUrl - This app is not allowed to query for scheme instragram
(3 answers)
Closed 1 year ago.
As described here to verify if an app is installed "some.bundle.id://" scheme and canOpenURL technique can be used.
However, I've discovered in SwiftUI 5 and iOS 14.1 that it doesn't always work, e.g.
// Works
UIApplication.shared.canOpenURL(URL(string: "com.garmin.connect.mobile://")!)
// Doesn't work
UIApplication.shared.canOpenURL(URL(string: "com.fitbit.FitbitMobile://")!)
I've found the error below in Mac's Console App log connected to iPhone. Looks like Fitbit app is blocking the queries:
default 12:03:34.339735-0700 2fahub -canOpenURL: failed for URL: "FitbitMobile://app" - error: "This app is not allowed to query for scheme fitbitmobile"
While in my Xcode's debug window I can see this:
2021-05-30 12:46:16.416998-0700 2fahub[588:100068] -canOpenURL: failed for URL: "com.fitbit.FitbitMobile://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
In my app query permissions are set correctly
<key>LSApplicationQueriesSchemes</key>
<array>
<string>com.garmin.connect.mobile</string>
<string>com.fitbit.FitbitMobile</string>
</array>
What else can be used to make sure that it always works? Is there anything similar to Android's PackageManager API in iOS?
Update #1:
Actually the answer provided by Fitbit forum was correct. The scheme for Fitbit must be "fitbit://" and it's absolutely not clear why, given that bundle ID for this app is com.fitbit.FitbitMobile. 'fitbit' is not the app name, neither it's the whole bundle ID. In Garmin case I must use the whole bundle ID to make it working. Would be good to know what the rules really are here. What should I do if need to add more apps to verify?
Seems the Fitbit's URL Scheme is not com.fitbit.FitbitMobile://(this is it's bundle id)\
Try with fitbit://
These two posts seem to have it working
Answer from 2016 - community.fitbit.com
Answer from 2020 - community.fitbit.com

Getting a LaunchServices error when trying to share to apple Books on ios

I am stuck on a problem, I'm trying to share from my app to Apple Books on iOS. When I perform the share action, the ActivityViewController acts like it is preforming the operation and everything appears to go well, however the shared file never appears in Books.
In the xcode console I get a Launch Services error:
2020-02-09 14:48:25.031316+0700 AppName[1040:282769] [default] LaunchServices: open operation <NSBlockOperation: 0x103006010> failed with error: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
service was canceled
I've looked around at what could be causing this and from what I can find, it seems most likely that my app does not have the correct permissions to access iBooks, but when I run UIApplication.canOpenURL for the iBooks schemes it comes back as true.
I opened up the simulator console as well where I found a bit more to this error:
Unentitled query <_LSDocumentProxyBindingQuery: 0x10253c750> issued from pid 1021. Disallowing and yielding an error.
Could not find apps for <private>: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=<private>}.
Invalid LSOpenOperation request: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
LaunchServices: [Perform] not launching application - result = Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
But I can't seem to find why the query is unentitled, or how to set it to be allowed.
I have tried adding the ibooks URL scheme to both LSApplicationQueriesSchemes and CFBundleURLTypes but that didn't make a difference.
I also tried saving the file manually and setting the NSFileProtectionKey to none per this post showing the same console error (not completely sure I implemented this correctly however)
I also tried using another app I've created that uses the activityVC to see if that app could share to iBooks and I get the same problem and the same error.
Sharing to all other iOS apps works fine, it is just iBooks that has the problem.
Any point in the right direction would be really appreciated!

How to open URL in tvOS simulator?

is there any way how to openURL in Xcode tvOS simulator (latest version) as there is no Safari installed on default?
The issue my Button returns now is following:
[default] Failed to open URL http://yoururl.com: Error
Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to
open "com.apple.PBLinkHandler" failed."
UserInfo={BSErrorCodeDescription=RequestDenied,
NSUnderlyingError=0x6000037458c0 {Error
Domain=FBSOpenApplicationErrorDomain Code=4 "Unable to open
application for the given URL. If this is a universal link ensure a
supported target app is installed."
UserInfo={BSErrorCodeDescription=NotFound,
NSLocalizedFailureReason=Unable to open application for the given URL.
If this is a universal link ensure a supported target app is
installed.}}, NSLocalizedDescription=The request to open
"com.apple.PBLinkHandler" failed., FBSOpenApplicationRequestID=0xec14,
NSLocalizedFailureReason=The request was denied by service delegate
(PBProcessManager) for reason: NotFound ("Unable to open application
for the given URL. If this is a universal link ensure a supported
target app is installed").}
Thanks in advance

API key not valid Kudan (AR) xcode

I'm a beginner to Unity and try to make a simple AR app (IOS). I followed some tutorials and faced a problem. I set the API key and BundleID in Unity correct and changed the "enable Bitcode" to NO. When I want to build & run the application I got the message:
Failed to code sign "Unity-iPhone"
"Fix Issue" the following message:
An App ID with Identifier 'eu.kudan.ar' is not available
When I change the Bundle Identifier to my own team and app name the 'obstacle' seems to be fixed. When the build is ready and the application starts (on the device) the following error occured:
Kudan.AR.KudanTracker:Start()
[ line 374]
(Filename: Line: 374)
2016-08-27 02:56:06.005 ar[633:164754] Error verifying license key for bundleID: eu.bart.CarAR error: (null)
2016-08-27 02:56:06.005 ar[633:164754] API key not valid
What am i doing wrong?
thanks!
You can maybe try with another key.
https://wiki.kudan.eu/Development_License_Keys
And it's normal if it doesn't work with own app name.

canOpenURL, problems adding site to whitelist

I am currently updating an app and using Xcode 7.3. The app utilizes iAd banner ads and Flurry interstitial ads. When the iAd banner goes to load I get the error.
-canOpenURL: failed for URL: "about:blank" - error: "This app is not allowed to query for scheme about"
The banner loads just fine, and everything works as planned.
In researching this I found the method was deprecated for privacy reasons. However, I can not even find it in any of my files. Also, I have read about adding sites to a whitelist with LSApplicaitonQueriesSchemes. I did this in my plist with the following strings in the array;
about:blank
about
blank
The error then reads;
-canOpenURL: failed for URL: "about:blank" - error: "(null)"
I can't seem to get rid of the error no matter what I do. Does anyone have any ideas of what to do? I see a lot of info for urls that go to social media apps and such, but not for the about:blank url. Thanks in advance.
You only need to whitelist about since that is the scheme being accessed.
The message -canOpenURL: failed for URL: "about:blank" - error: "(null)" means you have everything working. iOS logs that informational message when an app tries to call canOpenURL: for a whitelisted scheme but there is no app installed that supports the given scheme. It's a confusing debug message from iOS that can be safely ignored.

Resources