35

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.

Community
  • 1
  • 1
Evgenii
  • 36,389
  • 27
  • 134
  • 170
  • @rmaddy Why was this closed? The linked answer doesn't address this question. – Alex B Jan 14 '16 at 05:32
  • @AlexB because the OP accepted the answer below that quoted that other question. Since the OP accepted the answer, it indicated that they agreed it was a duplicate. But now I see the OP made an update to the question. I never saw that after marking this as a duplicate. I don't understand why the OP accepted the answer below if it wasn't a duplicate. – rmaddy Jan 14 '16 at 05:37
  • @rmaddy Well, now it clearly should be reopened, shouldn't it? – Alex B Jan 14 '16 at 05:39
  • I marked the Munahil's answer as solved accidentally, it did not answer my question. I have removed the "solved" mark now. – Evgenii Jan 14 '16 at 06:00
  • Did you ever figure out the purpose of the identifier field? If it isn't specified when calling openUrl, then how is it useful at all? – Adam Johns Jun 14 '18 at 03:43
  • It is useful for you/others in the same way as with localization keys & a message descibing what it is used for. – StackUnderflow Aug 20 '18 at 09:56
  • Right question but still after year no answer. Apple doc does not say something new. Still not explained what Apple uses CFBundleURLName for. – mikep Apr 24 '23 at 12:52
  • Where is this displayed? I think that's what would matter to most people reading this question. The docs are sparse, even the "required" comment in the main page is untrue, you can leave this blank in Xcode. – benc Aug 20 '23 at 04:53

3 Answers3

8

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.

Tibin Thomas
  • 1,365
  • 2
  • 16
  • 25
-1

If you have 2 application installed with same URL scheme like:

yourscheme://

then you have 2 conflicting apps.

How will the system decide to open which application launch?

According to the Inter-App Communication documentation

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

Please check this answer for the user who experienced the issue:

Also as far as I've tested and experienced, if you have 2 conflicting apps, it appears to be the first one installed which is used, and when this app is removed the second app which is now the only app supporting the specific URL scheme is still not used

Hope it helps.

MGY
  • 7,245
  • 5
  • 41
  • 74
-3

The URL Identifier is the reversed domain address which is should be the same as your Bundle Identifier e.g. com.companyname.appname

The URL Schemes is the start of the URL e.g 'appname'. When you call this as a URL it targets the bundle identifier which launches the app.

Reference : URL Identifier and URL Schemes

Community
  • 1
  • 1
Munahil
  • 2,381
  • 1
  • 14
  • 24