Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

url-scheme

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.

like image 998
Evgenii Avatar asked Aug 11 '15 03:08

Evgenii


People also ask

What is URL scheme in iOS?

Overview. A URL scheme allows you to launch a native iOS application from another iOS app or a web application. You can set options in the URL that will be passed to the launched application.

What does URL scheme do?

URL schema is used as an identifier in launching applications and performing a set of commands in iOS devices. The schema name of a URL is the first part of a URL. (e.g. schemaname:// ). For web pages, the schemas are usually http or https.


1 Answers

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.

like image 125
Tibin Thomas Avatar answered Sep 30 '22 17:09

Tibin Thomas