Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Should Universal Links work in iOS when using TestFlight? #39

Closed
TonivdW opened this issue Jan 29, 2016 · 21 comments
Closed

Should Universal Links work in iOS when using TestFlight? #39

TonivdW opened this issue Jan 29, 2016 · 21 comments

Comments

@TonivdW
Copy link

TonivdW commented Jan 29, 2016

Now I have my app working with universal links in Android, the next challenge is to get iOS working.
I have associated domains configured for both development and distribution.
I have placed an apple-app-site-association in the root of my website. I have not signed it as current Apple docs state that this is not necessary for universal links. It is served with mime type application/json. The contents is:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "S5ZZ8MTUAL.nl.ttapp",
        "paths": [
          "*"
        ]
      }
    ]
  }
}

I have submitted my app to itunesconnect and put it in the Internal Testing category.
As soon as I install (not open) the app through TestFlight I see the device do a request to my apple-app-site-association file.
However, the app is not opened from any link. I have tested from Safari, mail and pushbullet, but all of them just open a Safari window.
Do I really have to put the app into full production in order to get this to work, or have I missed some other crucial step?

@nikDemyankov
Copy link
Member

No, you don't need to publish it before you can test it. You don't even need to upload it on the TestFlight. If your setup in Member Centre and on server is correct - then it should launch.

So I would suggest to double check, that S5ZZ8MTUAL is a Team ID, not an old App ID. And that you have activated Associated Domains property in Member Centre for your app.

Also, try to open your iOS project in Xcode, go to Xcode -> Capabilities and check, that Associated Domains is ON. And that in Resources/ folder there is an .entitlements file with your domain in it.

@TonivdW
Copy link
Author

TonivdW commented Jan 29, 2016

I think I got all that covered:

screen shot 2016-01-29 at 16 38 10

screen shot 2016-01-29 at 16 39 06

File platforms/ios/TTapp/Resources/TTapp.entitlements:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.developer.associated-domains</key>
    <array>
      <string>applinks:ttapp.nl</string>
    </array>
  </dict>
</plist>

@nikDemyankov
Copy link
Member

Yes, seems so. Then it's only apple-app-site-association file left...
Just a stupid question: are you testing on iOS 9 device?
Also, when you click on the link and safari is started - do you see a smart banner on the top of the screen?

@TonivdW
Copy link
Author

TonivdW commented Jan 30, 2016

Yes, the iPhone is running iOS 9.2.1.
The smart banner is shown, but it links to the AppStore not to the app itself, as if it seems that the device does not know that the app is already installed. I suppose that the smart banner is not shown because of the universal links config, but because I have the following in the index.html (on the site):

<meta name="apple-itunes-app" content="app-id=1028916533, app-argument=https://ttapp.nl/#/">

fejlwlev0g6q9rkyczvsq8nnhez6jle9scq8kiywmmdglexq9sw8ocwp4fc6-zafa5pzikxhcla7ompa1hyrcrpwsz0 s852

@nikDemyankov
Copy link
Member

What will happen, if you'll try to open from your email a link like https://ttapp.nl/path/test/ ? It doesn't have to exist on your server. The idea is to check what will happen, if you'll open something, that doesn't lead to the root domain.

If it still doesn't open - try to create an empty page like https://ttapp.nl/path/test/test.html without anything in it (mainly - no <meta /> tag for smart banner). And open it from the email. Will the banner appear?

But besides all of that - if your app is properly configured in the Apple Developer Console, has all the preferences in the Xcode and correct apple-app-site-association - it should open. And according to the info you provided - you did all of that... So yes, I'm a bit lost here...

Another experiment that can be done is the following:

  1. Launch the app from the Xcode on your testing device (not emulator).
  2. Set a breakpoint on the line 21 of the AppDelegate+CULPlugin.m.
  3. From the email click on a link https://ttapp.nl/path/test and check, if the breakpoint is hit.

If it does - check what is returned on line 31. It should be YES.

@nikDemyankov
Copy link
Member

As mentioned another developer, who used this plugin - he had to release the app in order for UL to start working. Which is still weird...

@TonivdW
Copy link
Author

TonivdW commented Feb 2, 2016

Both test-links have the same effect: they open in safari.
I tried the experiment you advised and have seen it hit the breakpoint and return YES twice and the app opened. Twice. But now, whatever I do, i cannot get it to work again. No code change whatsoever. This is so strange...

@nikDemyankov
Copy link
Member

Let me get this clear: you tried to open https://ttapp.nl/path/test and it opened in the app 2 times in a row. But on the 3rd attempt it stopped doing so? Then there can be few reasons for that:

  1. While being in the app you clicked on the link in the upper left corner of the screen: https://github.com/nordnet/cordova-universal-links-plugin#useful-notes-on-universal-links-for-ios . As a result - that link will keep opening in the browser until you hit "Open" button of the smart banner.
  2. Something wrong with the device accessing apple-app-site-association file on your server. Maybe bad internet connection, or apple for some reasons doesn't trust it.
  3. Some weird behaviour from Apple and not-published applications.

With 3 there is nothing can be done, except publishing the app.

With 2 you can try two things:

  1. Use 4G instead of wi-fi on the device. Maybe some problems with routings.
  2. Open your iOS project in the Xcode. Open <YOUR_PROJECT_NAME>-Info.plist and add to it:

screen shot 2016-02-03 at 11 41 35

In some cases iOS 9 can reject HTTPS connections. And that option in the property list will tell him not to do so.

And as a final resort - publish app on the App Store. Plugin shouldn't effect user in any negative way, so if UL still would not work - he won't get any problems.

@TonivdW
Copy link
Author

TonivdW commented Feb 3, 2016

I am not yet at the point to release it to the AppStore, because (and maybe I should open another issue for this) Universal Links seems to require a minimum version of iOS 8, and I still have a number of happy iOS 6 and iOS 7 users. I am perfectly ok for them not to have the UL feature, but I can not just shut them off because they have an old device. Can I somehow include UL in the package but not touch that code on older iOS devices?

@nikDemyankov
Copy link
Member

You can comment the following lines of the plugins hook. They are responsible for setting deployment target to not less then 8. I didn't want to set it lower, since don't have a way to check that it will not crash on older devices.

@TonivdW
Copy link
Author

TonivdW commented Feb 3, 2016

I have removed and re-added the plugin and on cordova prepare I now get:

IOS project Code Sign Entitlements now set to: TTapp/Resources/TTapp.entitlements
Entitlements file is not in references section, adding it

I can't remember having seen this before, but it might have been there. What worries me is that it keeps saying this, so the 'adding' operation apparently did not work? Might this be related to the problem? Do I need to change a file/setting?

@nikDemyankov
Copy link
Member

IOS project Code Sign Entitlements now set to: TTapp/Resources/TTapp.entitlements

That message was there the whole time, and it's fine.

Entitlements file is not in references section, adding it

That one means, that plugin tried to find entitlements file in Xcode project, but didn't. So he added it. To check that just open Xcode project and check, if TTapp.entitlements is in the project and added in target:

screen shot 2016-02-04 at 10 08 04

If it is - just ignore the message.

@TonivdW
Copy link
Author

TonivdW commented Feb 4, 2016

Unfortunately I'm not a full fledged iOS developer and Xcode user, just using it to put the iOS image into the AppStore, so please take me by the hand. Where can I find this 'Target Membership' listing?
It just worries me that it keeps saying that the setting is not there and that it will be added. Seems to me that it should only mention this once only.

@nikDemyankov
Copy link
Member

You are right, it should display that only once. Strange, that it keeps showing up. But if the file is there and added to the project - you can ignore it. As an experiment - just create a new Cordova/Ionic project from scratch.

To check if file in place - just open your iOS project in Xcode, find TTapp/Resources/TTapp.entitlements and click on it. Then in the upper right corner click on the panel, as on screenshot, and find Target Membership. You should see a checkmark near the name of your project.

screen shot 2016-02-04 at 10 27 25 - 2

@TonivdW
Copy link
Author

TonivdW commented Feb 4, 2016

Ah, thanks, found it. Seems ok to me:

screen shot 2016-02-04 at 10 42 28

@nikDemyankov
Copy link
Member

Seems so. Then you can ignore the message in the console. What it does - it's just adding file to the Xcode project. And if it's in there and in the target section - then it's fine.

@TonivdW
Copy link
Author

TonivdW commented Feb 5, 2016

I finally got it working!
What made the change is adding the '/' path in the apple-app-site-association file:

  "paths": [
          "*", "/"
        ]

Also: for me as a non-frequent iOS user the following was not known to me:

  • if a link is opened in Safari you need to pull down the screen to get the smart-banner with the 'OPEN' link.
  • in Mail, you need to long-press the link to get to the 'Open in ....' prompt.

Also worth knowing, but I think you already documented that, iOS only retrieves the apple-app-site-association file once and once only. If you make subsequent changes to the file it will not be detected. Fortunately, the first update of the app from the store that includes UL capabilities, will also retrieve the file. I would have hated to ask my users to de-install the app first...
Once the UL link to my app is set, iOS remembers this, and a single click on the link in a mail opens the app.
Not all third-party apps behave well though. I can't get PushBullet to open the app. I will try to find a SIM for my phone to test WhatsApp (which is kind of important to me, I expect my users to distribute links through WA)

@nikDemyankov Thank you very much for your support and patience with me!

@nikDemyankov
Copy link
Member

Great! Thank you for the comments above :) This will be very helpful for others, who might struggle with UL.

Actually, it is strange, that you had to add / in the paths of apple-app-site-association file: * should work fine, since it states "any path".

But nonetheless, good, that you solved it :)

@TonivdW
Copy link
Author

TonivdW commented Feb 6, 2016

For the record:
WhatsApp also correctly supports UL and opens my app perfectly.
Facebook uses an own WebView to display my website. On Android you can then click the menu-dots on the top-right and choose 'Open in TTapp'. On iOS you have a 'share' button top-right which has a 'Open in Safari' link. Clicking this will actually open my app, not Safari.

@nikDemyankov
Copy link
Member

Thanks for the info :)

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #160 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants