Setting Entitlements in Package


#1

I’d like to build using the Package service, but (I think) we need to be able to grant the KeyChain entitlement via XCode prior to building. Does the package process upload my xcode project file or will I need to be able to set the entitlement in the package service somehow?


#2

Why is that? (Actually: What does that mean exactly?)


#3

Hi Sujan -

In XCode, you can add entitlements to a build that allow the application to perform certain tasks in the underlying operating system. It appears to me that I need the application to have the KeyChain Sharing entitlement in XCode in order to be able to read a previously written keychain value (without this entitlement, the value always comes back null). But I haven’t found a way to set that entitlement from config.xml so I’m not sure how the build process on the Ionic Package service will know to set that entitlement.

Any thoughts?


#4

Ok, so some custom native code of yours needs this entitlement?

Normally I think these should be added by the native Cordova plugins that require them and are used to execute the native code, I think the push plugin does this already. See here for some background on Cordova: https://issues.apache.org/jira/browse/CB-11854 and https://github.com/fechanique/cordova-plugin-fcm/issues/140 Unfortunately I can’t find anything in the Cordova docs at the moment, but maybe I’m looking in the wrong place.


#5

No, no native code of my own, just a pretty general use of the keychain plugin to save a value and then try to read it back. When I call keychain.get(‘my_key_name’) I get “null” as the response unless this entitlement has been granted.


#6

Aha, a native Cordova plugin. You haven’t mentioned that before.

Can you provide a link to the plugin you are using? How are you using it?
Normally the plugin should take care of the entitlement stuff, see my links I posted.