Kodeco Forums

Universal Links – Make the Connection

Learn how to connect iOS app with your website using Universal Links, so users can tap a link and be sent directly to the corresponding content in your app!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1123-universal-links-make-the-connection

how to intercept the Universal Links,as in my app when i access a taobao product link it auto open the taobao app and outside my app.i need show the product detail info in my app with my webview,how can i do that?

Will this work with the FaceBook app or do I need another approach?

When a link is clicked on a website, it checks that website’s apple-app-site-association file. Since it is on the taobao site, it checks for their apple-app-site-association file. I don’t believe its possible to intercept this even though it may be your product listed. If you are able to post a link to your site with the product, then it would check your apple-app-site-association file as it followed the link.

  • Owen

Sorry but can you clarify?
-Owen

thanks for your reply, as i know the wechat(weixin) app and the safari app can stop a link(maybe universal link) to open the corresponding app,For example,if your iOS device had installed the “蘑菇街” app when you click a product link(http://m.mogujie.com/x6/detail/18h73iw?from=tuan&acm=1.ms.1.0.1662.0rxpIV3d943.295&ptp=m1._mf1_tuancube-indexh5.0.22.HbFJo) in most of apps it will open the “蘑菇街” app directly,but if you click the link in wechat/safari app it will not,do you know how did wechat/safari app do that ? thank you very much!

Hi Owneb, I have followed your tutorial. Great tutorial so far. But I am getting the following error on iOS device console. -

[SWC] ### Bad apple-app-site-association JSON: Error Domain=NSCocoaErrorDomain Code=3840 “JSON text did not start with array or object and option to allow fragments not set.” UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

Can you please tell me that what am I doing wrong…? Please do reply and try to help me to get me out of this. I have tried almost every solutions over the internet but no use. Though the resource is also not perfectly available.

Hi icruncher,
It appears to be something wrong with your apple-app-site-association JSON file. If you copy/pasted from the tutorial webpage text, its possible some extra non-printing characters were brought in. Something is causing the JSON file to be corrupted.

My suggestion is to clear the JSON file (i.e. CMD-A, then delete) and manually type it as shown in the tutorial (with your App ID of course).

I did all those tricks including manually written the whole JSON but still getting the same issue.

icruncher,
Here are a couple app search validation tools that might help.

Hi, I was wondering, do these works for apps that target 7.1? or is at least 8.0 required for Universal links to work properly given the association file?

What’s up doc_hollandaise? (couldn’t resist :slight_smile:)
Universal links require iOS 9 and later according to Apple’s info. Check out this link and read the first note.

It says:
NOTE
In iOS 9 and later, universal links let users open your app when they tap links to your website within WKWebView and UIWebView views and Safari pages, in addition to links that result in a call to openURL:, such as those that occur in Mail, Messages, and other apps.

For users who are running versions of iOS earlier than 9.0, tapping a universal link to your website opens the link in Safari.

  • Owen

Hey, can you please help me? I have implemented this and the problem I am getting is that when I click on a link, I am redirected to web instead of app. And when I scroll down a bit in safari, I am getting a banner which has OPEN button also. By clicking it, my app opens and the specific view controller according to the logic opens. So why it is opening in browser? If app is installed, it should directly open in app.

Hi muneeb,
Where is the link initially that you are clicking on?
See the initial link and the OPEN button link are exactly the same. Clicking the same link, either in an email or on the web browser should take you to the same place.
By the way, is the OPEN banner on your website?

Owen

Hi Owen - I am working on a Stripe iOS application. Stripe will fire up a Redirect URI back to my website. I need to intercept it with my iOS App. Can this be accomplished?

thanks
Sha

Hello sha,
According to this Apple Dev link, as long as the app calls openURL then Universal Links should kick in. Personally, I haven’t used Stripe.

Universal links let users open your app when they tap links to your website within WKWebView and UIWebView views and Safari pages, in addition to links that result in a call to openURL:, such as those that occur in Mail, Messages, and other apps.

Owen

Hi Owenb - How about if it is a redirect url coming from somewhere else
I make a call out to Stripe to create a standalone account. Once that
is completed, Stripe executes a redirect url that comes back to my web
server. Can my iOS app intercept it?

Thanks again.
Sha

Hi Sha,
Sorry but I have no experience with Stripe.
What exactly is happening? Are the results shown in Safari instead of hitting the app?

Owen