Search code examples
ioslaunchurl-scheme

Open iOS app when a URL with a certain pattern is opened


I have successfully mapped my app to a custom URL Scheme, so when I type myApp://path my app opens. To do so I used Info.plist's CFBundleURLSchemes and CFBundleURLName.

I wonder if I can map a URL pattern too, instead of the scheme, so when somebody types

http://mylegitdomain.info/blah

my app opens. This is possible in Android.


Solution

  • There isn't a built-in way to do this - the http: and https: schemes automatically open Safari.

    However, here's what you could do:

    1. Register mylegitdomain.info
    2. Run a server that simply redirects requests to mylegitdomain.info to myApp://path

    This won't be quite as seamless to the user - the URL will open Safari and then redirect to your app - but it will work, and it might be worth it depending on your use case.