I'm trying to add a new custom URL scheme in my app. I've registered the new scheme in my Info.plist and it is working both from within the app and externally (I type my custom URL into Safari and it launches my app and calls my OpenUrl method).
However, I'd like to restrict this custom scheme to only be accessible from within my app. According to the Apple documentation:
Use the
application:willFinishLaunchingWithOptions:
andapplication:didFinishLaunchingWithOptions:
methods to retrieve information about the URL and decide whether you want to open it. If either method returns NO, your app’s URL handling code is not called.
I've tried a variety of combinations for both the FinishedLaunching(UIApplication, NSDictionary)
and WillFinishLaunching (UIApplication, NSDictionary)
, returning false
for either or both. However, even after doing this I am still able to open my custom URL scheme from Safari. I get a prompt asking "Would you like to open the URL in ?", so the fact that it is even asking it seems incorrect. I've tried force-uninstalling the app from the simulator and doing a clean build and republish, with no luck. I've also tried returning false in the OpenUrl
and [according to Apple doc, deprecated] function HandleOpenURL
with no luck.
What am I missing? It's like the false
in those methods isn't taking effect.
Thanks!