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
332 stars 218 forks source link

Deeplinks not working on iOS when using Ionic cloud build #121

Open xims opened 7 years ago

xims commented 7 years ago

I'm using Ionic Cloud Build to build apps https://apps.ionic.io/apps/

I'm adding Deeplink plugin to my Ionic project using native plugin (https://ionicframework.com/docs/native/deeplinks/)

I've added it to the project with

$ ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=app.example.com --save 
$ npm install --save @ionic-native/deeplinks

This correctly added the following to config.xml

<plugin name="ionic-plugin-deeplinks" spec="~1.0.14">
    <variable name="URL_SCHEME" value="myapp" />
    <variable name="DEEPLINK_SCHEME" value="https" />
    <variable name="DEEPLINK_HOST" value="app.example.com" />
</plugin>

I've obtained the updated iOS certificates (both dev and distribution) to support "Associated Domains" in the App ID on https://developer.apple.com.

I've added https://app.example.com/apple-app-site-association that looks like

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "XXXXX.com.example",
                "paths": [ "*" ]
            }
        ]
    }
}

The Android links are working great. But iOS links are not handled by the app and keep being opened by the browser.

I'm not sure where is the problem. What can I do to fix it or at least how can I see what's broken?

Thanks

cyptus commented 7 years ago

i got the same issue. The problem is, that the associated domains from the entitlements file in the resources order is not recognized. The generated project.pbxproj file references CODE_SIGN_ENTITLEMENTS to APP\Resources\APP.entitlements which cannot be resolved from xcode because of the unescaped backslashes. If you open the generated project in xcode you will see, that xcode handels the path as APPResourcesAPP.entitlements. Replacing the backslashes with slashes in the project.pbxproj file like APP/Resources/APP.entitlements makes xcode detect the file and the associated domains (appurls) and fixes the issue (when upload via xcode i had to uncheck and check again the "automatically manage signing" checkbox and reassign the team below, before archiving the project).

I am not sure if you can change the URLs in the file and let "ionic package build" upload the changed file while i regenerates the file with the ionic package command.

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???

cyptus commented 7 years ago

@ordas as i mentioned you should check the generated entitlements and project.pbxproj file. if you got the same issue with the slashes as i get and you need to use ionic package build, you need to find where ionic generates the project.pbxproj file and repair the paths.

ordas commented 7 years ago

@cyptus How do I do that in ionicCloud ??

cyptus commented 7 years ago

@ordas i do not. As i said, the ionic package command generates the slashes in the wrong format for me. Please check your project.pbxproj file in an text editor and search for "CODE_SIGN_ENTITLEMENTS". There should be 4 references. Contains these genearted paths slashs, or backslashs in your file?

ordas commented 7 years ago

In the 4 references, and I have slashes

qmarcos commented 7 years ago

@ordas I think your problem is the same reported here: #97

The thing here is that hooks are not supported on cloud builds...

Maybe the hook created by @lpg-mac could be added to the common hooks repository.

I hope to find a solution for this, I'm surprised that some ionic-team plugins doesn't work on cloud builds...

qmarcos commented 7 years ago

We have sent a PR to the repo, to add this hook to the common that are already accepted.

The PR is awaiting for ionic team review right now, hopefully it'll be accepted soon. https://github.com/ionic-team/ionic-package-hooks/pull/41

fdambrosio commented 6 years ago

I have the same problem