Why do we need "URL Identifier" (CFBundleURLName) plist field to use custom URL scheme on iOS?

Evgenii picture Evgenii · Aug 11, 2015 · Viewed 14.6k times · Source

I am using a custom URL scheme to open my iOS app when this web link is tapped on the device: Demo77://someurl

To set it up, I added Demo77 as an item to the URL Schemes (CFBundleURLSchemes) array in the Info.plist.

Apple documentation says I also need to include URL identifier (CFBundleURLName) string key into the Info.plist. This key contains the "abstract name of the URL scheme".

I did not include the URL identifier key and the links still open my app. Everything works without the URL identifier.

Question: do I really need to include the URL identifier key in the plist? And if so - why?

enter image description here

Update

This question is different from URL identifier and URL scheme where it is asked what "URL Identifier" key is used for. I am not asking what it is used for. I am asking if we need to use "URL Identifier" at all? URL schemes in my app work perfectly well without it. Note that answers to the URL identifier and URL scheme question do not address my question at all. Sorry if my initial question was not clear enough.

Answer

Tibin Thomas picture Tibin Thomas · Aug 22, 2018

According to apple docs

The identifier you supply with your scheme distinguishes your app from others that declare support for the same scheme.

Although using a reverse DNS string is a best practice, it does not prevent other apps from registering the same scheme and handling the associated links. Use universal links instead of custom URL schemes to define links that are uniquely associated with your website.

So to answer your question adding a url identifier doesn't change much,but its best to include it,as it is specified by apple.