Alex from Branch.io here:
The good news is that it is much easier than you expect. However, since you made such a complete report, I will go through all the details so that you know exactly what is going on behind the scenes.
Brief explanation
To handle the launch of the application upon installation, you do not need to manually set your custom URI scheme as a value of $ios_has_app_url - Branch and iOS implement this design behavior for you.
If your links do not start your application, you may have a problem setting up Universal Links. I recommend that you review this troubleshooting guide .
Long explanation
Our control parameter $ios_has_app_url depends on the value of boolean has_app , which is monitored by our servers. The has_app value has_app pretty accurate in typical real-time mode (good enough to switch the button between displaying the Open or Install label on a smart application banner, for example), but not 100% accurate in all situations.
This is a limitation of iOS: Apple does not allow web pages to request which applications are installed on the device (for obvious privacy reasons), therefore Branch must rely on cookie compliance. This means that if we cannot match the cookie or have not seen the user recently, or the user will clear the device’s cache, or the user has deleted the application since the last time he saw it, the has_app value will be incorrect. If the has_app value has_app incorrect, the behavior of $ios_has_app_url will also be incorrect.
HOWEVER, although Apple does not allow web pages to request access to this data, iOS itself can still act on it. Universal Links do just that - when a user opens a universal link (which includes branches, provided that you have made the entire configuration), the application will open if it is installed. If it is not installed, the user will be sent to the link URL.
Intended use of $ios_has_app_url
The Branch $ios_has_app_url is for a very specific usecase in advanced implementations; the vast majority of our partners never use it. Here is a potential situation in which you might want to:
You have a boundary case where Universal Links are not supported , and you want to send your users to another web page if Branch knows they are installing your application, and do not give them the opportunity to open it. Obviously, this is a rare situation, usually related only to enterprise-level applications.
Debug has_app
If you are stuck trying to debug a situation where has_app returns the wrong value, you have several options:
- If you get
true and want false , use the private browsing mode in Safari. This prevents the creation of a cookie branch, which means you always get false . - Alternatively, follow these steps:
- Ensure that the setDebug application under test is enabled .
- Paste the link to the smart banner code page in Notes.
- Uninstall the application.
- Settings> General> Safari> Clear website history and data.
- Settings> General> Safari> Advanced> Website Data> Swipe left and delete each entry.
- Settings> General> Privacy> Advertising> Reset Advertising ID ...
- Click the link in Notes (from step 1).
- The banner should always show “Download” (when it’s not, because cleaning up the website’s data was unsuccessful).
- Click Download.
- Launch the application through Xcode (serves to install it).
- Stop the application in Xcode, then launch it from the phone.
- Click the note link again - the button should now show "Open" and open the application.