Closed mikeduarte closed 6 years ago
This is not a bug, this is totally fine. You can have as many entitlements files as you want.
From the native developer perspective, to enable Universal Links in Xcode you need to:
Capabilities
tab of your project and activate Associated Domains
feature.applinks:<your_domain>
, where <your_domain>
is... your domain :)As a result, Xcode will generate .entitlements
file with proper data. And this file is usually created in the root folder of the project.
Our plugin does all that on a cordova build
phase (or ionic build
):
.entitlements
file if it doesn't exist in the Resources
folder. If it does - it will append data to it.config.xml
.Code Signing Entitlements
because it is a custom entitlements file.Why do I put it in the Resources
folder? No reason, actually. Just because I like it to be there. Plus less chances of conflicts with the existing entitlement file. If you want - you can move it.
Excellent, thank you again for the thorough explanation. Everything is working very well, great work!
Thanks :)
Hi Nik,
I am having a related issue with v1.2.1 of the plugin.
I can see the /Resources/myApp.entitlements
file being created but it doesn't seem to be added to the build target as you mention, nor is the path to the /Resources
folder added to the 'CODE_SIGN_ENTITLEMENTS'.
It only seems to be added to the build when placed under the root folder of the project.
I'm running Cordova 6.4.0 and build for iOS >9.0
Am I missing anything?
@MarsupiL I'm facing the same issue. I see the file under Resources/<appname>.entitlements
but XCode cannot seem to recognize it. That is why when I look under the Associated Domains under Capabilities, none of the links are there. Any idea why ? cc @nikDemyankov
Thank you very much for your help in advance!
Hi @adityasaxena @MarsupiL,
Tried it on the fresh project and .entitlements
file was added to the project, and I can see Associated Domains
active in the Capabilities
tab.
Can you give me some more info, please:
If I would be able to reproduce it - I should be able to fix it...
I haven't tried on a new project yet, but I managed to fix it using the cordova-custom-config plugin to add the CODE_SIGN_ENTITLEMENTS and the content of the Entitlements-Debug.plist and Entitlements-Release.plist files introduced in Cordova-ios 4.3.0. I'm using node 7.0.0 and Cordova-ios 4.3.1
Prior to 4.3.0 Cordova didn't have entitlements file, so I had to implement a custom hook that will generate it and add to the Xcode project. But now they do - so yes, one way to go is to use your approach. Although, it's strange that you are facing this issue :(
So I created a new project and can confirm that there is a conflict with the cordova-custom-config plugin. The plugin itself does not create issues but as soon as I set any preference for an XCBuildConfiguration element in the config file it seems to remove the CODE_SIGN_ENTITLEMENTS set to /Resources/myProject.entitlements
defined by your plugin.
Unfortunately I do need to use this plugin to set up various config elements :/
Okay, thanks for the input, will check it out. At least now I know how to reproduce it.
Correction: even without any custom config preference set, the custom-config plugin overrides the entitlements set in the project.pbxproj
Maybe you can just change the hook to before_compile
, since custom-config installs on after_prepare
and changing it to before_prepare
doesn't seem to add all config changes.
I'm the author of the cordova-custom-config plugin and I've finally made some time to look into this.
I'm unable to reproduce a scenario where this plugin causes the loss of the reference to the entitlements file created by the universal links plugin - see this screencapture for my test results.
For more details, see my last comment regarding this on the issue opened against cordova-custom-config regarding this behaviour.
@dpa99c and @nikDemyankov this is definitely an issue for anyone who uses the Cordova CLI as its intended. If you do a "cordova platform add ios" without any plugins, and look at the build.xcconfig file for ios, this points to the Entitlements file that should contain all of your capabilities such as push, or whatever else..
CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist
When plugins modify the value of CODE_SIGN_ENTITLEMENTS for their own purposes and point to Resources/{appName}.entitlements, they dont merge with the capabilities or other config thats already set in Cordova's Entitlements-debug.plist or Entitlements-release.plist files. This messes up Cordovas automatic release/export through the CLI because now you're required to manually change capabilities before building/releasing. This is a problem for people who use the Cordova CLI as intended to where you shouldnt even need to open Xcode and can do Continuous integration builds.
Basically, plugins need to upgrade their hooks to set entitlements values in Cordovas Entitlements-debug.plist and Entitlements-release.plist files that are generated with the CLI, rather than invalidating those files
Update: I found and fixed a bug (see #108) which should resolve this issue when this plugin is used in conjunction with cordova-custom-config
. The bug has nothing to do directly with modification of CODE_SIGN_ENTITLEMENTS, but was a race condition in file I/O which caused cordova-custom-config
to overwrite modifications made by this (and other) plugins.
The fix has been published in a patch release: cordova-custom-config@3.1.3
Thanks so much! I had fixed this in another plugin but that was in internal thing. Glad we have the fix now. Cheers!
the problem is still there. Use https://github.com/chancezeus/cordova-universal-links-plugin in mean while, it has the problem fixed.
đ 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.
@nikDemyankov
Hi again,
One more question about the plugin. I am using Xcode 7.0.1 and before I installed your plugin, my Cordova project already had an entitlements file in the Root directory with an entry for webcredentials:mydomain.com. The name of the file being My Project.entitlements. When I do a Cordova Prepare command, the plugin adds another entitlements file in the Resources directory with applinks:www.mydomain.com and the file has the exact same name as the other entitlements file in the ROOT directory. Everything works fine with the universal links as I posted before in the other post. My question is whether this is a bug or intentional?
I also noticed that under Build Settings > Code Signing > Code Signing Entitlements is pointing the entitlements file that the plugin created in the Resources directory.
Thanks!