when my app is not intalled, iOS universal link in UIWebView will launch Safari? - ios

From Apple's guide in Support Universal Links:
When you support universal links, iOS 9 users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
But i'm confused that if my app is not installed,and I tap a universal link of my app in another app's UIWebView,will the system launch Safari app to load my website,or still load it in the UIWebView?
I test some app's universal links when the app is not installed,and they never launch Safari to load the next page ,they still load it in the UIWebView.
I want to konw if it's possible to launch Safari,but not stay in UIWebView.Do I need any configuration in apple-app-site-association file?
Actually I want to trace where my app was installed from by using cookie.I can store a cookie in Safari with informations of the download page,and get the cookie with SFSafariViewController when my app is installed and opened,and present different views according to the cookie.

What you are trying to build is called 'deferred deep linking'. This (plus a lot more) is exactly what we provide at Branch.io. If you want to avoid the headache of configuring it all yourself, give this a look. Apps like Pinterest, Airbnb, and Tinder all use us for this reason.
Apple's documentation is referring to the default behavior with the standalone Safari browser. Handling links inside an app with UIWebView supersedes this, and there is no way to automatically bounce out of the origin app into the main Safari app.
The workaround is to store data on your own backend. As you've discovered, relying on a cookie pass-through on the device itself won't work in many cases.

Related

Installing iOS App Directly From Safari Web UI?

I was using a website, and noticed that from my iphone on Safari, I could directly install their app from the Web UI. This was from the top of the page at https://flytap.com/ . I can't find what this is called or how to do it anywhere in the iOS documentation. This only seems to work in Safari.
Does anyone know what they are doing, or how I can do it?
This is done via adding Universal Link support (documentation here).
The banner you are seeing is the Universal Link smart banner (documentation here).
In-short, you should have a website, the website should be SSL enabled, you need to add an apple-app-site-association-file which defines the links your app needs to handle, make changes in your app to handle Universal Links and you should be good to go.
The app you shared has its apple-app-site-association file here. You can view this file for any app that supports Universal Links using the pattern https://<SITE_BASE_URL>/.well-known/apple-app-site-association or https://<SITE_BASE_URL>/apple-app-site-association.

Branch.io Deeplink not working in safari in ios 9, But it works in chrome

Deeplinks working perfectly when using chrome iOS app. But in safari it stopped working and it always redirect to the appstore page even the app is installed or sometimes pop a alert saying "safari cannot open the page because the address is invalid". Everything works perfect few days back. so my guess is this happens after the ios 9.2 update. Any solution for this?
UPDATE
I have tried using a new phone(Which app not installed before) and installed the app.
Deep links works for both browsers (Safari and Chrome).
If you push the bnc.lt forward button it opens App Store for both Safari and Chrome.
Next time you open a link deep link:
Safari: It asks if you want to open the link in app store
Chrome: It asks if you want to open app and at the same time redirects to app store. If you click open in app next time you click a deep link it will open in app.
So in other words you can still open the app from Chrome after clicking the bnc.lt forward link in staus bar. This is because Chrome asks for opening the app and not app store.
For Safari i end up in an irreversible state where the deep link always open app store and not the app.
Alex from Branch here: this is the expected behavior. Unfortunately our fallback options are rather limited at the moment, due to the changes to Universal Links in iOS 9.2.
TL;DR: it's a bit of an edge case that most users wouldn't encounter, but you can easily work around it by making use of our Deepviews functionality.
Basically, here's the logic behind what you're seeing:
When you open the link on a device without the app installed, you end up on our bnc.lt server, and we redirect you to the App Store so you can get the app. This is good.
When you open the link on a device with the app installed for the first time, your device detects the Universal Link and opens the app immediately. All this happens locally on your device, and you never even get to our bnc.lt server. This is also good.
When you push the bnc.lt forward button, you're telling your device 'I don't want you to immediately open the app...show me the web content for this link instead'. In the case of a Branch link, this 'web content' is simply a redirect to the App Store. At this point, Branch has no way to know whether you the app is installed or not, so we have to assume it isn't and you get the same treatment as 1. above. This is not so good, but right now we don't have any better options due to the way Apple has designed the system.
The next time you open a link, your device remembers that you pushed the bnc.lt button in the past and just takes you straight to the web content. I'm not sure why Safari does it this way, because I can't imagine many situations where this would be desirable and it is leading to a lot of confusion for users.
The real problem here is that when you press bnc.lt to bypass the app, your device remembers this preference and executes it every time it sees a bnc.lt link in future. Chrome still 'works' because it is proactively confirming the preference each time in 4., whereas Safari just plows forward. There are a few options for what happens next:
In Apple's ideal world, you'd end up on a normal webpage where you could simply scroll up and use the Open in app button to reverse this preference. But since Branch is immediately redirecting you to the App Store, this isn't an option. You could consider using our Deepviews feature, since this does provide some real web content in place of the immediate App Store redirect you're seeing right now.
In most situations, you can still long-press on the link and select Open in app, but this doesn't help users who don't know the option is there.
In the worst-case scenario, you end up on the App Store page and just press the Open button (instead of Install). Thanks to Branch's magic, you'll still end up in the right place!
Now from iOS 9.2, Apple no longer supports URI schemes for deep
linking, developers must implement Universal Links in order to deep
link properly on iOS.
Universal links let you replace custom URL schemes with standard HTTP or HTTPS links. Universal links work for all users: If users have your app installed, the link takes them directly into your app; if they don’t have your app installed, the link opens your website in Safari.
To learn all about universal links, see
How to support Universal Links in iOS App and setup server for it?
Example
https://github.com/vineetchoudhary/iOS-Universal-Links
UPDATE [1]
How Branch links work (Branch.io)
If you take a lock at fundamentals of Branch's contextual deep links. You found Branch.io also using traditional deep-linking
1. Creating links
When you’ve integrated the Mobile SDK, you can create a Branch link every time a user clicks to share or invite another user from within your app. Your app makes a call to Branch.io, and Branch.io return a Branch link.
2. Tying data to links
3. Clicking links
4. Using data
Check the Clicking links step, Branch.io just map your website URL with your app URI scheme but URI schemeno longer supported by Safari. So, move to Universal Links is only the option in order to deep linking in iOS 9.2 or you can wait for some solution by Branch.io. Thanks.

iOS 9 Universal Links not launching the app from the same domain

I have setup my AASA JSON file to open the app when someone visits myDomain.com/ShowInTheApp/*
This works from Notes App, Email, Gmail App, Gmail web on safari and basically any other websites other myDomain.com .
When myDomain.com/chooseAppORweb.html contains a link to myDomain.com/ShowInTheApp/ , safari always opens it in the same tab, app wont get launched. I can tap and hold the link to show the context menu that contains an entry "Open In [My app name]" which will indeed launch my app. But not by single tapping on the link.
When I do the exact same steps from another domain, NOTmyDomain.com/chooseAppORweb.html always launches the app without issues.
Has anyone succeeded in launching the app consistently from the same domain using UL ?
Also, if there is an Apple's document that explains any of these behaviours, please share the link.
I'm not sure when Apple added this to their documentation, but it's explained on their Support Universal Links page, in the first 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.
When a user is browsing your website in Safari and they tap a universal link to a URL in the same domain as the current webpage, iOS respects the user’s most likely intent and opens the link in Safari. If the user taps a universal link to a URL in a different domain, iOS opens the link in your app.
For users who are running versions of iOS earlier than 9.0, tapping a universal link to your website opens the link in Safari.
(Emphasis added)
Essentially, once a user reaches a page hosted on your domain in Safari, any links they follow on your domain will be opened in Safari, even if they're defined as Universal Links by your app.
As st.derrick mentioned above, this is the in-place behavior for Universal links. If you have previously been taken to the App from the link, but then choose to be taken to the website when prompted with a long press, the functionality to open the App will break. You can remedy this by long-pressing again and choosing to open in-app. It's not an ideal solution, but it is the only way I've seen it be fixed. I hope this helps!

How to use UIWebView to display a website in an iPhone app?

I am using UIWebView to open a link in my app and I submitted it to the AppStore which resulted in the rejection with reason of 2.12 of review guidline which says
2.12: Apps that are not very useful, are simply web sites bundled as apps, or do not provide any lasting entertainment value may be rejected
Is it because I used UIWebView to open a web site.
UIWebView are used to open the websites. But your application must have certain more features.
The application containing only a UIWebView to open a website is of no use as instead you can open the website directly in the Safari and in that open the Actionsheet from the bottom bar and tap on Add to Home Screen option. It will be same as the application you have tried to upload on Appstore.
It is not because you open a website with UIWebView, but it might be because your app does only that. Your app must do more that just that.
As far as my knowledge you are not providing any useful information i.e nothing is special in your app

How do Apple detect if an iphone app is installed when clicking on a pure html link?

I am trying to detect if my ipad app is installed on a device when visiting my website, in order to suggest different action to the visitor.
Thanks to this post :
https://stackoverflow.com/a/8310348/1128754
I found that the "store" application on iphone seems to have achieve to detect if the app is installed on the device. When you click on store links, it launch the app instead of going to the mobile web version.
For example, if you go to :
http://store.apple.com/xc/anythinghere
with an iphone on which apple store app is installed ( http://itunes.apple.com/app/id375380948 )
it automatically start the store app, instead of the web page.
I tried to follow the stack call with mitmproxy but safari doesn't seems to ask query before launching the app.
So, I guess they did custom url scheme recognition, with http:// links.
Do you think it is possible?
This is done with URL protocol handlers:
http://www.iphonedevfaq.com/index.php?title=URL_schemes#URL_Protocol_Handlers
You cannot detect if an app is installed from HTML, but you can launch an app. For example, the popular game "Doodle Jump" can be launched by going to doodlejump://, but if you don't have it installed, the link won't work. As mentioned, this is done with a custom URL scheme and needs to be coded into your app.

Resources