Multiple apps with the same URL Scheme - iOS

IosXcodeUrl Scheme

Ios Problem Overview


So for my new app I'm having a URL scheme so that people can launch my app from another app or from a website... "myapp://" ... So what happens if there is another app in the AppStore that has the same URL scheme as mine? Or if someone tries to steal my URL Scheme?

Ios Solutions


Solution 1 - Ios

If two apps register the same custom URL scheme, it is undefined which app will actually be launched. One will be launched but there is no way to know.

Here's a real kicker. If you have two apps on your device with the same URL scheme, and you delete the one that actually gets launched, the other one will not get launched by the URL without rebooting the iOS device.

Your best solution is to ensure your custom URL scheme is not trivial so there is little chance another app will have the same scheme.

Solution 2 - Ios

According to the Apple docs:

If multiple third-party applications register to handle the same URL scheme, it is undefined as to which of the applications is picked to handle URLs of that type.

Exact quote from the Apple docs, for 8 consecutive years: >Note: If more than one third-party app registers to handle the same URL scheme, there is currently no process for determining which app will be given that scheme.

Sources:

As of September 2019, this part of the documentation was removed from the Apple website. The closest related document may now be Register Your URL Scheme.

Solution 3 - Ios

Updated for 2016

Apple's policy has changed since 2012. Today they indicate that multiple apps will not be allowed to register for the same scheme. Registration time is a much cleaner place to address contention than runtime, since it avoids the security issues discussed it other answers.

> Note: If more than one third-party app registers to handle the same URL scheme, there is currently no process for determining which app will be given that scheme.

Source:https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html#//apple_ref/doc/uid/TP40007072-CH6-SW1

Solution 4 - Ios

As covered by the other answers in this thread, it is perfectly acceptable for multiple apps to be registered as capable of handling a particular custom URL scheme, and if there are 2+ apps installed on the device which are capable of handling a particular custom URL scheme, it is undefined as to which app will be selected by the system at runtime.

If it is important for your particular use case that your app and only your app is registered on the device as capable of handling a particular URL, then prefer universal links over custom URL schemes. Universal links are standard HTTP or HTTPS links and the rough idea is that, on installation of your app, the system checks a file stored on your web server to verify that your website allows your app to open URLs on its behalf. If your app is not installed on the device when such a URL is opened, the system opens the URL in Safari as normal, allowing your website to handle it.

For further information on both universal links and custom URL schemes, refer to the Allowing Apps and Websites to Link to Your Content documentation page.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlbert RenshawView Question on Stackoverflow
Solution 1 - IosrmaddyView Answer on Stackoverflow
Solution 2 - IosDustinView Answer on Stackoverflow
Solution 3 - IosBoshView Answer on Stackoverflow
Solution 4 - IosAdil HussainView Answer on Stackoverflow