Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS system hangs before opening App Store URL

  1. I have a HTML page with a Download app button. When clicked by an iOS user, it redirect the users to the App Store via itms-services. The link I used here is:

    window.location.replace("itms-apps://itunes.apple.com/app/id578505616"); 

    It looks like so on a mobile browser: Mobile webpage with Download button

  2. Facebook/Pinterest has an in-app browser which asks for the user's consent before redirect the user out of their app in the form of an Alert box with Cancel or Open app, which Open app opens the external link. It looks like this: Mobile webpage with Download button embedded in Facebook

It looks like this with the Alert box: FB embedded browser with alert box

Assuming the user is using an iOS device. The expected behavior here is when the Open app button is clicked, the user gets redirected to the App Store app. However, we are seeing about a 10 seconds delay before the actual redirection happens.

See videos below:

https://www.youtube.com/watch?v=_dgh7v-IsK8

https://www.youtube.com/watch?v=_LFHeRnBFgg

https://www.youtube.com/watch?v=82Y-kj-pMyw

Notes:

  1. I can't seem to reproduce this at all times. It is only reproducible sometimes. Sorry!
  2. Once a device is delayed for the first time, all subsequent links to AppStores will be fast, until roughly 1 day late. Rebooting the phone and/or clearing the browser cache and/or reinstall Facebook/Pinterest does not help reproducing this.
  3. I tried to replace the itms-apps:// link with https://itunes.apple.com/us/app/trusper-tips-tutorials-how/id578505616?mt=8, but we were still experiencing the delay from time to time.
  4. The delay seems to be exactly 10 seconds.

Why does this delay occur? This seems like a bad user experience.

My current theory is that the problem is on the Apple side. The reason being, once the Open app button is clicked, it is out of the hand of our website, as well as Facebook/Pinterest app. I presume, once the button is clicked, iOS is handling the actual context switch from one app to another. Therefore, it suggests that either the system call actually opening the URL is hanging, or the system call opening the App Store app is?? However, I haven't been able to prove either one to be true or false. Does anyone have a better explanation?

[Edit 04/02/2015] I can confirm this problem still exists as of today on my phone (iPhone 5S w/ iOS 8.2). I did some further research and found this article which I think is suggesting that this is a iOS system-related bug: OpenUrl freezes app for over 10 seconds

like image 624
ethangui Avatar asked Mar 25 '15 23:03

ethangui


People also ask

Why is my iPhone App Store Not Working?

First, try logging out and then log back into the App Store on your iPhone – that should fix it: Go to Settings > iTunes & App Store. Tap on Apple ID at the top of the screen, then hit Sign Out. Log in again using your Apple ID and password.

Why does my iPhone say Cannot connect to iTunes store?

Make sure that your device is connected to the internet Use any web browser to connect to any website. If nothing loads, use another device on the same network to see if it can connect to any website. If no other devices can access the internet, turn off your Wi-Fi router, then turn it on again to reset it.


1 Answers

As there is no proper documentation on how it works, it is hard to pinpoint the cause of it.

Let me advance a theory.

  • Opening an app from browser causes a context switch; indeed from browser to App Store. So for the very first time it'd cost some time, while in subsequent times it will open faster as it will get opened from cache.

  • If you consider AppStore uses Keep-alive connection between iOS AppStore in device and iOS AppStore Server for the first time socket opening in server would seem higher than the subsequent times as subsequent request would reuse the same connection.

  • If the app is removed from the cache then it'd again take some time for the app to open and there would be a little network delay as the app would have lost the cookie for keep-alive connection then the app would have to endure the socketing opening cost.

  • There are also other factors like Safari hanging, resulting in some delay. You can read how Safari can be messed up here.

  • iOS doesn't have garbage collection, only things like ARC (Automatic Reference Counting). Each has its own advantages and drawbacks. Sometimes these drawbacks can surface and cause some problem; nothing is to be ruled out. For example a memory leak or app-crash might leave dangling pointers.

  • Technically, using itms-apps should give a little advantage over plain iTunes url because itms-apps should narrow down the search; itms-apps mean iTunes Music Store-apps. A plain iTunes URL may be a Book (iBook), Music (iTunes), App (Appstore), etc ... so iOS might have to decide which app to launch.

I hope this helps.

like image 60
Durai Amuthan.H Avatar answered Sep 19 '22 22:09

Durai Amuthan.H