Search code examples
iosrubymotion

Is there a way to intercept URLs so they are opened in my app


Is there a way to intercept URLs on iOS (iphone/iPad) such that a URL from a specific host is always opened by my app and not by the browser?

Example: http://myapp.com/ref/123 -> gets opened by my app and I parse out the 123

Update

I find it really weird that this isn't allowed on iOS (iphone/ipad). On Android I've been able to intercept a url and whenever it begins with http://myapp... it gets opened in my app.

How does the community solve the issue of: Say a user who has my app installed on their iphone gets a link from a friend in an email. When they click it, if the link can't be opened in my app...how else am I suppose to do anything good with the shared url? OR should I not be passing http:// links but myapp:// instead??


Solution

  • The scheme name (or protocol) of a URL is the first part of a URL - e.g. schemename://. For web pages, the scheme is usually http (or https). The iPhone supports these URL schemes:

    http, https, ftp    Web links* (Safari)
    mailto  E-mail links (launches the Mail app)
    tel Telephone Numbers (launches the phone app)
    sms Text Messages (launches the SMS app)