Closed LKaemmerling closed 4 years ago
Hello @LKDevelopment,
Unfortunately, the Branch Cordova SDK does not use Push Notifications. We only use Associated Domains for URI Scheme deep linking.
Additionally, if you dig into your <APP_NAME>.entitlements
file, you should see that this SDK does not add the aps-environment
key.
<?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:cordova.app.link</string>
<string>applinks:cordova-alternate.app.link</string>
</array>
</dict>
</plist>
Are you using another plugin for Push Notifications? You might want to investigate that plugin.
Thanks,
Hello @ethanneff,
i use the one signal push plugin. Without the branch.io sdk it works without any error, but with the branch.io sdk there is the error, so it seems to be a error from the branch.io sdk :) The ionic support says the same, i think they could send more informations on this: @ionic-team @BrianIonic
Is there any update on this issue? We are experiencing the same problem. Did anyone solve this issue?
Nope, the only working solution was to leave branch.io out of the app.
So we can't use both branch and one-signal plugin together. Right?
Is there any other solution or plugin available to do the same?
Yeah it isn't possible together... I can't find an other solution so we leaved the feature out....
Thanks for posting. I have this issue too. Adding additional information in the hope that this issue can be resolved.
In my case, creating binaries with IonicPro results in "Missing Push Notification Entitlement" and breaks the push notifications feature. However, I created a local environment to replicate the issue and surprisingly it's working (in development). I've confirmed that both deep links and onesignal push notifications are working. I don't know why building on my local is different to building on IonicPro. Building locally doesn't work for our team so I'm still working on a final solution.
Ionic:
ionic (Ionic CLI) : 4.0.0-rc.9
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.9
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : ios 4.5.4
System:
ios-deploy : 1.9.2
NodeJS : v8.9.4 (/Users/matthew/.nvm/versions/node/v8.9.4/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
There were two key things that where needed to make this work.
<edit-config file="*-Debug.plist" mode="merge" target="com.apple.developer.associated-domains">
<array>
<string>applinks:53es.app.link</string>
<string>applinks:53es-alternate.app.link</string>
<string>applinks:53es.test-app.link</string>
<string>applinks:53es-alternate.test-app.link</string>
</array>
</edit-config>
<edit-config file="*-Release.plist" mode="merge" target="com.apple.developer.associated-domains">
<array>
<string>applinks:53es.app.link</string>
<string>applinks:53es-alternate.app.link</string>
<string>applinks:53es.test-app.link</string>
<string>applinks:53es-alternate.test-app.link</string>
</array>
</edit-config>
I tried every combination of things I could think of or find online but XCode would never include these domains in the final binary. It worked, if I pasted these domains directly into the MyAppName.entitlements file (in the root).
<?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>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<!-- Existing strings -->
<string>applinks:myappname.app.link</string>
<string>applinks:myappname-alternate.app.link</string>
<!-- Strings I added manually. -->
<string>applinks:53es.app.link</string>
<string>applinks:53es-alternate.app.link</string>
<string>applinks:53es.test-app.link</string>
<string>applinks:53es-alternate.test-app.link</string>
</array>
</dict>
</plist>
I noticed that the applinks:myappname were always being generated but I'm not using a custom domain with Branch.io. So I changed config.xml to use the assigned domain "53es".
<branch-config>
<branch-key value="key_live_..." />
<uri-scheme value="myappname" />
<link-domain value="53es.app.link" />
<ios-team-release value="XFN..." />
</branch-config>
Branch.io then generated the following. Note the missing test domains. I'm not sure how to resolve that. But at least this allowed a binary to be successfully generated without manually updating.
<?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>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:53es.app.link</string>
<string>applinks:53es-alternate.app.link</string>
</array>
</dict>
</plist>
This hack worked in Ionic3 for creating an iOS binary using IonicPro. Both push notifications and branch.io deep links are confirmed working. This also seems to confirm that branch.io somehow removes this entitlement during a build. Hopefully, someone from the branch.io team can resolve this.
Note that the key difference between an IonicPro build and our local build is that IonicPro adds the ios platform on the fly during the build process.
/ios_push_entitlement_hack.sh
#!/bin/bash
if grep -q aps-environment platforms/ios/MyAppName/Resources/MyAppName.entitlements; then
echo "Push notification entitlement already exists."
else
echo "Push notification entitlement added."
sed -i '' '/^[[:space:]]*<dict>/a\'$'\n''\'$'\t''<key>aps-environment<\/key>\'$'\n''\'$'\t''<string>development<\/string>\'$'\n''' platforms/ios/MyAppName/Resources/MyAppName.entitlements
fi
config.xml
<platform name="ios">
<hook src="ios_push_entitlement_hack.sh" type="after_platform_add" />
Hello,
In branch SDK we do not use push notifications, neither in code nor in XCode settings. Our findings are as follows:
Removed “one signal push” plugin from the project and submitted to iTunes. Accepted successfully! We are enabling push notification in XCode only for “one signal push” plugin as follows.
Please note that while using push notification, iTunes could throw this type of error if we do not do as follows: Open the project in Xcode. Select your App from the menu Target. Go to “Code Signing Entitlements” in “Build settings” in Target and check the path of the entitlement.
Thanks
Guys the problem is that you overwrite the entitlement completely, not that you use push notifications or everything else. The way you overwrite the entitlement looks wrong. But okay, when you say "Not our problem", then Branch is not the right solution for Ionic Developers.
@LKDevelopment sorry about this -- we're gonna fix the overwriting of the entitlements.
@LKDevelopment @matthew-valenti
Branch sdk currently sets the code signing entitlements differently in App_Name.entitlements file which is inside the Resource folder (under the root folder).
It does not use the App_Name.entitlements file in the root folder for this purpose. As a result when we archive the app, it takes the configuration from inside the Resource folder, where the aps-environment key is not present. (One Signal plugin is unaware of the Resource folder) and hence you are facing this issue.
A temporary workaround for this issue is to manually edit the code signing entitlement, that is the Entitlements-release.plist file in the root folder.
I am facing this issue as well which is now breaking a production app. I'm not sure what @sequoiaat is referring to as the main *.entitlements file is altered as well. I suspect I could write a post-hook that will edit the entitlements file but why is this happening? What is the official solution?
I came across the same thing (using Cordova 9), also using OneSignal/push entitlements.
As far as I understand, I previously only had Entitlements-Debug.plist
and Entitlements-Release.plist
files for entitlements, which contains the correct keys for push from OneSignal and associated domains.
This plugin writes to [APP_NAME].entitlements
file, and the Resources/[APP_NAME].entitlements
, which only contains the associated domain keys. It also modifies the location of the entitlements file
Doing a diff between with branch-sdk installed and without results in the notable differences of:
Only in cordova-branch/platforms/ios/[APP_NAME]: [APP_NAME].entitlements
Only in cordova-branch/platforms/ios/[APP_NAME]/Resources: [APP_NAME].entitlements
Files cordova/platforms/ios/[APP_NAME]/Entitlements-Debug.plist and cordova-branch/platforms/ios/[APP_NAME]/Entitlements-Debug.plist differ
Files cordova/platforms/ios/[APP_NAME]/Entitlements-Release.plist and cordova-branch/platforms/ios/[APP_NAME]/Entitlements-Release.plist differ
therefore I am convinced that this plugin is doing something unusual with respect to standard Cordova practice (the last two modifications are correct).
See https://github.com/nordnet/cordova-universal-links-plugin/issues/8#issuecomment-289472886 for a similar issue.
Related to #252
This should be resolved in the latest release.
Hello guys,
i wanted to start to use branch.io with my ionic app. I added it and on of course it works. But since i add the sdk, on every build i submit to the itunes store there comes an error from the app store:
After some debugging with the ionic dev team, it turns out, that this sdk has the same problem described here: https://ionic.zendesk.com/hc/en-us/articles/360001923973?input_string=ios+builds+-+missing+push+entitlement
Can you have a look into this? I must remove the sdk from the app since i can't release the app on ios with it :)
Thank you!