2

When defining the custom URL scheme for my app there are 3 keys that I need information about:

  1. CFBundleTypeRole a.k.a Document Role
  2. CFBundleURLName a.k.a URL identifier
  3. CFBundleURLSchemes a.k.a. URL Schemes

I can see, if I just define CFBundleURLSchemes to be myapp the app is launching fine with an URL as myapp://. Questions are:

  1. Is the URL identifier there only to make my scheme unique? How does it do that? If I have same scheme myapp defined in 2 apps, and I call myapp:// can I specify which one I want to call by calling myapp://<URL Identifier>? Edit: What does this URL Identifier actually do? Does it only give a name to url? How it is used?
  2. The Role defines the level of permission which is None, Viewer or Editor, I am not sure what level of permission my app has on the launched app as I have not defined anything. I would like to know what is the default permission when the CFBundleTypeRole is not defined.
Anindya Sengupta
  • 2,539
  • 2
  • 21
  • 27

2 Answers2

1

to 1:

A protocol is not guaranteed to be unique. There is no parameter you can define that will open app1 or app2. If two apps use the same scheme it is undefined what happens

to 2:

the role is irrelevant for the most part BUT mandatory:

  • editor = launched because they can R/W files identified by the same
  • viewer = can only read and display
Community
  • 1
  • 1
Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • roles are more important when it comes to document types IMHO – Daij-Djan Aug 14 '14 at 10:50
  • But when I don't define anything in the Role, what is the default role? – Anindya Sengupta Aug 14 '14 at 11:01
  • docs: "This key is required." -- read as: no default because needed. – Daij-Djan Aug 14 '14 at 13:06
  • As I stated, I am able to launch my app without specifying the key. Though it states to be required. – Anindya Sengupta Aug 14 '14 at 13:54
  • yes, sure you are and then you have an undefined state – Daij-Djan Aug 14 '14 at 14:19
  • Thanks @Daij-Djan for your response. The question boils down to: whether my application is safe when the key is not defined. – Anindya Sengupta Aug 14 '14 at 15:07
  • 1
    I would guess it is safe for now but as soon as you can: change it – Daij-Djan Aug 14 '14 at 16:10
  • I did understand the key is "REQUIRED", but my current app which was in the App Store did not have this key defined. That is the reason I wanted to know whether it is safe or not. Honestly, saying "REQUIRED" does not really tell me whether it is safe, does it? Thanks for your advice, I am planning to change it in the next release. Just assessing my current situation. Thanks again for the answer. – Anindya Sengupta Aug 14 '14 at 16:27
0

Ad 1)

According to Apple documentation they don't give much info about the identifier and why it is needed or where it is used. They only say that it should be unique.

Also if more than one app specify the same url scheme, then the outcome is unpredictable.

See URL identifier and URL scheme

Ad 2)

The Role flag isn't used by iOS.

See In Xcode, under Info tab, what's Role for in URL Types section?

Marián Černý
  • 15,096
  • 4
  • 70
  • 83