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 220 forks source link

Question: Deeplink in iOS works ok when running from XCode but not from Ionic CLI #97

Open AresDev opened 7 years ago

AresDev commented 7 years ago

I'm working on an app that uses deep links and everything works just fine when I build and run the app from XCode but when I run it using ionic run ios --device it doesn't work and in consequence, our builds generated from CI and uploaded to Hockey App have the same behavior.

I've created an app from the ground up, added the plugin and platform and it behaves the same.

Can you please help me?

lpg-mac commented 7 years ago

Same problem here, and what I'm seeing seems to agree with the referenced issue(s): this plugin adds entitlements to platforms/ios/<appname>/<appname>.entitlements, but current cordova-ios command-line builds don't use that file, they use platforms/ios/<appname>/Entitlements-{Debug,Releas}.plist instead (by setting CODE_SIGN_ENTITLEMENTS in platforms/ios/cordova/build.xcconfig)

Since this suggests building via the XCode GUI does NOT use platforms/ios/cordova/build.xcconfig, I'm reluctant to actually go that way, since it's not clear what else is in that xcconfig that might be important.

lpg-mac commented 7 years ago

Worked around the issue with a cordova after_prepare hook to add the entitlement to the correct plist files (using node.js 'plist' module).

AresDev commented 7 years ago

Can you share this hook please?

lpg-mac commented 7 years ago

@AresDev here you go.

gist: https://gist.github.com/lpg-mac/02abd3a77f1c880e8f9d59af4423c5af

Replace YOUR APP HERE and YOUR DOMAIN HERE by appropriate values (ideally they'd be fished out of config.xml)

Then add something like this to config.xml:

  <platform name="ios">
    <hook type="after_prepare" src="scripts/deeplinks-entitlements.js"/>
  </platform>

(after_prepare seems to cover all our use cases, but we didn't spend too much time choosing the right one)

ordas commented 7 years ago

I have the same problem on iOS, deeplinks working fine using xCode, but using Ionic Cloud Build NO WORK!!!

Any solution please???

qmarcos commented 7 years ago

@lpg-mac what do you think about contributing to common hooks repository with your hook?

Deeplinks plugin doesn't work on cloud builds (it's a expected behaviour), so it'll be great to be included into the repo: https://github.com/ionic-team/ionic-package-hooks

Anyway... if you don't have time but you authorize me... I'm interested in doing it.

lpg-mac commented 7 years ago

@qmarcos I don't expect to have the time to "generalize" the hook in the near future (at least need to make app and domain values configurable). Please feel free to go ahead.

qmarcos commented 7 years ago

Great news @lpg-mac, we are going to work on that direction, I'll keep you updated! Thanks again!

qmarcos commented 7 years ago

Hi @lpg-mac we have done the required adjustments to the code in order to send the pull request.

The PR is awaiting for ionic team review right now. Hopefully it'll be added to the repository of "accepted" hooks soon. https://github.com/ionic-team/ionic-package-hooks/pull/41

Thanks a lot for your work!

fdambrosio commented 6 years ago

I have the same problem