iOS Dev Nugget 156 -canOpenURL:


Need to run a code review on your codebase? Hire me

Many of us use -canOpenURL: in our apps. Common usage include to detect if other apps of ours have been installed by the user, or switch to another app (using -openURL:) to perform a specific task. In iOS 9, -canOpenURL: has been changed to read from a white list of URL schemes specified in your app's Info.plist file.

Note that while -canOpenURL: requires white listing, -openURL: doesn't.

To white list URL schemes, add this to your Info.plist file:


Note that you should only include the schemename part of schemename://.

Even if you don't use -canOpenURL: directly in your apps, you may be asked to white list URL schemes when you include certain third party libraries/SDKs.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No



Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter


View archives of past issues