Search code examples
iosobjective-ccocoa-touchcore-foundationurl-scheme

Custom URL Scheme Parameters


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.

Solution

  • 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