Domanda

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??

È stato utile?

Soluzione

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)

Altri suggerimenti

iPhone apps can specify their own custom URL scheme (for example, myapp://doStuff). But it's not possible to redirect a specific http host to be opened by your app.

To add a custom URL scheme to your app follow this guide,

Custom URL schemes

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top