Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Universal Links works locally but not from AppStore Apps

After installing the app manually from xCode (with the device plugged to the MacBook) I can click mails with a link to the Web App and it opens it into the cordova app instead of the web app (as expected).

But when I download and install the app from AppStore or testFlight (with the exact same code base), Universal Links are ignored and the Web App is opened.

When I monitor Apache logs, and installing the app manually, I get :

XX.XX.XX.XX - - [29/Aug/2018:14:32:33 +0000] "GET /.well-known/apple-app-site-association HTTP/1.1" 200 730 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"

But while installing the app from testFlight or the AppStore, there is no request for that file.

Can someone help me to find even a clue to search for... How can I enabled UniversalLink for my production app?

[EDIT] from the john316's answer

I unzipped the IPA generated, openned the embedded.mobileprovision and I had:

<key>Entitlements</key>
<dict>
    <key>keychain-access-groups</key>
    <array>
        <string>XXXX.*</string>     
    </array>
    <key>get-task-allow</key>
    <true/>
    <key>application-identifier</key>
    <string>XXXX.my.domain.com</string>
    <key>com.apple.developer.associated-domains</key>
    <string>*</string>
    <key>com.apple.developer.team-identifier</key>
    <string>XXXX</string>
    <key>aps-environment</key>
    <string>development</string>
</dict>

Associated domains are enabled but shouldn't they have an array of string with all my applinks:domains?

like image 917
Alexandre SIRKO Avatar asked Aug 29 '18 15:08

Alexandre SIRKO


People also ask

Why do links not open in app?

Every android app will have list of urls that it can open. So you have to go to that app settings and tell that it should open in browser for the urls and not in the app. To do that go to Settings -> Apps -> scroll down to the app that you don't want URLs to open in -> Tap on 'Open by Default' and select always Ask.

How do I deep link an iOS app?

All you have to do is tell the app which scheme would you like to use. For this just Open Xcode, got to Project Settings -> Info, and add inside 'The URL Types” section a new URL scheme. Add something of the sort of com. myApp and that's it.

What is the difference between universal link and deep link?

What is the difference between deep link and universal link? There aren't many differences between universal links and deep links. Universal links are a technology specially created by Apple to adapt deep linking to their devices. According to Apple, universal links are safer and more performing for their needs.


2 Answers

In my experience of observing differences like what you describe, in most cases, it has been due to the difference in the apps entitlements for dev & distribution profiles. Even though you may clearly state in your app project settings that you need certain capability (in this case "Associated Domains" checkbox), Xcode may not throw any error during signing process (when you export the app for distribution) if certain entitlements are missing in the provisioning profile.

They may be missing for 2 reasons - they may not have been added at the developer.apple.com portal for this profile, or Xcode didn't refresh the profile file from that portal. In the latter case, it helps to erase the old profile from your local disk to force Xcode to redownload it.

To verify that you actually have the com.apple.developer.associated-domains entitlement in your distribution file, you can unzip the IPA file and check for the com.apple.developer.associated-domains key in <key>Entitlements</key> section as specified here.

Another way to debug this is to look at the device logs in the Console (Xcode-> Window-> Devices&Simulators-> Open Console), when running the AppStore/TestFlight version of the app. You can find a log line that's output by the iOS when the link is followed correctly into the app for the dev version of the app, and compare it with the case when it fails. Usually iOS complains at that point about missing entitlements, in the logs.

like image 142
john316 Avatar answered Oct 01 '22 01:10

john316


Finally I was able to fix this issue:

Make sure that Entitlements-Release.plist includes the correct entitlements. In my case, only Entitlements-Debug.plist had the correct entitlements. Also when you export your app at the last step you usually should see a summary regarding included entitlements, make sure that com.apple.developer.associated-domains is listed with the appropriate applinks entry.

It should look similar to:

enter image description here

source: https://forums.developer.apple.com/message/334862

like image 37
menelik Avatar answered Oct 01 '22 01:10

menelik