xamarin / ios-samples

Xamarin.iOS sample apps

Home Page:http://docs.microsoft.com/xamarin/ios/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SecKeyChain.Add return MissingEntitlement(-34018) everytime.

ErBhautik opened this issue · 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.