ionic-team / ionic-plugin-deeplinks

Handle deeplinks into your Ionic/Cordova apps from Universal Links, App Links, and Custom URL schemes. For those using Ionic 2, there are some nice goodies that make life easier.
Other
333 stars 218 forks source link

iOS: plugin working in Xcode device build but not in testflight builds #154

Open pttao opened 5 years ago

pttao commented 5 years ago

Plugin works well on device when building and deploying directly to device throught Xcode but does not route (opens URL in Safari) when tested on a build deployed to device through Testflight. iOS 11.4.1 ionic: 4.1.1

itsdarja commented 5 years ago

Same for me - It works perfectly on XCode build and in development build for android, but once I upload it to test flight it looks as if the link is not registered. However in android the link does open the app, but nothing happens afterwards.

SteveBunlon commented 5 years ago

Yep same for me. Works like a charm when I'm testing on android devices and IOS devices (with XCode). But when I test the deeplinks on IOS devices using testFlight, it looks like the deeplinks are simply not registered.

Would be glad to have info on how to solve this to be able to test again using testFlight <3

fermedina commented 5 years ago

Same for me. Works fine when i'm testing on iOS device, but testing in TestFlight only works sometimes. I could not say what is the reason why sometimes it works and sometimes it does not.

pkimmlinger commented 5 years ago

Same here. Working in Xcode but not in TestFlight or as released version in App Store

itsdarja commented 5 years ago

I think I might have discovered the issue - provisional profile!

When I disabled the "Automatically manage signing" option, I can see the following errors: "Provisioning profile "...." doesn't support the Associated Domains and Push Notifications capability. Provisioning profile "..." doesn't include the aps-environment and com.apple.developer.associated-domains entitlements.

Also, in the https://developer.apple.com the current distribution provisioning profile status is Invalid.

So my hypothesis is that creating a new provisional profile with all the services we need should solve the problem - I did not however have the time yet to actually create new profile and test it, but I wanted to let you know if it helps anyone.

UPDATE: Nope, it didn't help - I now figured out the problem is with registration of the link when installation happens - it simple doesn't register - when installing in development via cable, I can see in the phones console: "Added service 'applinks', appID 'myteamid.com.mycompany.appName', domain 'link.mycompany.com'"

and when I install afterwards via testflight, i can see: "Removed service 'applinks', app ID 'myteamid.com.mycompany.appName', domain 'link.mycompany.com' (removed domain) "

itsdarja commented 5 years ago

@pkimmlinger, @pttao - you seem to have the exact same problem as I do - did any of you managed to solve the issue? I seem to be stuck.

pkimmlinger commented 5 years ago

No, I haven't found a solution yet.

SteveBunlon commented 5 years ago

Me neither :'(

SteveBunlon commented 5 years ago

Well, I don't understand what's going on there but sometimes when I install the app directly from XCode, the deeplink works fine, and sometimes not. Same behavior using test flight O.o I don't know how where when to investigate ^^

pkimmlinger commented 5 years ago

I asked in Ionic-Slack Channel, here is the answer:

"There are lot of issues with XCode 10, not with Ionic itself, but Cordova - the devs recommend using latest 9. I personally encountered many different issues, so decided it's not worth the effort until it is officially supported"

I think we have to wait for a new version of Cordova-ios

itsdarja commented 5 years ago

I FINALLY got to the bottom of this with help of Apple Developer Technical Support. In my (cordova) project folder there are two files:

Entitlements-Debug.plist Entitlements-Release.plist

When I add the value applinks:mywebpage.com to Capabilities->Associated domains->Domains, the Entitlements-Debug.plist got the lines:

<key>com.apple.developer.associated-domains</key>
<array>
  <string>applinks:mywebpage.com</string>=
</array>

BUT the Entitlements-Release.plist did not change. What I did to solve the issue is to copy-paste the generated lines form the Entitlements-Debug.plist. After this, I did the exact same Archive and upload process as before and everything worked fine.

fermedina commented 5 years ago

Hi @itsdarja. To add the associated domains to Entitlements-Debug.plist and Entitlements-Release.plist automatically you can add this in your config.xml file:

<config-file parent="com.apple.developer.associated-domains" target="*-Debug.plist">
        <array>
            <string>applinks:mywebpage.com</string>
        </array>
    </config-file>
<config-file parent="com.apple.developer.associated-domains" target="*-Release.plist">
        <array>
            <string>applinks:mywebpage.com</string>
        </array>
</config-file>

I thought that this was the problem, but it has not been solved either. Occasionally there are devices that after installing the app from TestFlight open the URLs with Safari.

SteveBunlon commented 5 years ago

@itsdarja @fermedina are you my heroes ?

I'll test this out next release, and I'll give you feedbacks :)

Thanks for investigating !

iliraga commented 5 years ago

@fermedina Thanks a lot. Spent around 6 hours debugging that stuff.

As a sidenote: When uploading a Build, in the Activity Tab within iTunes Connect you can check that in the Build Details. Scroll to the bottom where you can see the "Store Information"

If the com.apple.developer.associated-domains is missing in the Entitlements you got yourself some trouble :)

SteveBunlon commented 5 years ago

Hellooooow,

I'm back with good news. I figured out that YES, the entitlement file was missing or incomplete. So I used @fermedina solution (with a script to clean this up if I build for Android) and it works now :)

Cheers