Adding Keychain record issue for storing credentials

Danny.BDanny.B USMember
edited November 2016 in Xamarin.iOS

I am trying to store user credentials in the Keychain using the following code:

var record = new SecRecord(SecKind.GenericPassword)
{
    Service = "userservice",
    Label = "username",
    Account = username,
    ValueData = NSData.FromString(password),
    Accessible = SecAccessible.Always
};

var statusCode = SecKeyChain.Add(record);

However I am getting a SecStatusCode of "-34018". I have made sure I checked the "Enable Keychain Access Groups" in the Entitlements.plist and have also and tried passing in the keychain group explicitly as an AccessGroup parameter in the SecRecord - but the same thing.

Anyone have a solution to this or if I am doing something wrong in creating the SecRecord?

Many thanks,

Danny

Tagged:

Best Answer

Answers

Sign In or Register to comment.