문제

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

도움이 되었습니까?

해결책

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)

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top