xamarin/ios-samples

SecKeyChain.Add return MissingEntitlement(-34018) everytime.

ErBhautik opened this issue · 1 comments

Hi,
I am storing device unique id using SecKeyChain(-34018) but it always return MissingEntitlement error.Below is my sample code.

    void StoreKeysInKeychain(string key, string value)
    {

        var s = new SecRecord(SecKind.Identity)
        {
            ValueData = NSData.FromString(value),
            Generic = NSData.FromString(key)
        };
        var err = SecKeyChain.Add(s);
    }

You need to add an entry in Entitlements.plist - open the Entitlements.plist in the iOS project and find the Keychain entitlement and enable it. This will automatically add the application's identifier as a group.