Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Auth Store Keychain not working after ios10 upgrade

I'm using Xamarin.Auth (https://components.xamarin.com/view/xamarin.auth/) to store my credentials, as I've always done.

var accountStore = AccountStore.Create (); foreach (var account in  accountStore.FindAccountsForService("myAppName"))     accountStore.Delete (account, "myAppName");  AccountStore.Create().Save(acc, "myAppName"); 

After the upgrade to iOS 10 I get this error storing credentials:

"Could not save account to KeyChain: -34018"  at Xamarin.Auth.KeyChainAccountStore.Save (Xamarin.Auth.Account account,System.String serviceId) [0x000b2] in <402cf9b3716845b3bdddef581cb33a3e>:0  

Latest version installed 1.2.3.1 The problem seems to persist only on the SIMULATOR

like image 446
Ziba Leah Avatar asked Sep 14 '16 09:09

Ziba Leah


2 Answers

I was digging through the link Pat sent in the comment: bugzilla.xamarin.com/show_bug.cgi?id=43514

And found a helpfull comment by Pavel Sich, he said:

Just make sure you enable the keychain access in Entitlements and select the entitlements for Simulator (Debug) builds too. By default this is not set.

In my xamarin solution, I double clicked the .IOS project to open the options pane, selected IOS Bundle Signing and changed the Platform select box from "iPhone" to "iPhoneSimulator", then set the field Custom Entitlements to my Entitlements.plist. Now it's working fine for me.

Just a note, this is after editing the Entitlement.plist as suggested by Thibault D. in the previous answer.

Hope this helps.

like image 118
Rafael Avatar answered Nov 14 '22 00:11

Rafael


According to this thread it's enough that you add an empty entitlements file in you bundle singing configuration:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">   ...   <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> </PropertyGroup> 

Empty Entitlements.plist file:

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> </dict> </plist> 
like image 41
Thibault D. Avatar answered Nov 13 '22 23:11

Thibault D.