SecureStorage icon indicating copy to clipboard operation
SecureStorage copied to clipboard

IOS KeyChain not saving value, xcode 9

Open Doublebock opened this issue 7 years ago • 14 comments

Hi, I've been using the SecureStorage plugin on Android and UWP and it has been working fine. I just started testing IOS but the plugin/keychain only returns empty values. xcode 9, iphone 8 simulator. Custom Entitlements is not set. (Setting this causes a profiling error I cannot resolve at this time.)

I found this and wondered if it's related. https://forums.developer.apple.com/thread/87449. I am accessing the plugin for a portable library which seems different situation than their unit test issues.

Following is a clip of the code. SetValue does return false. value = "test"; var r = CrossSecureStorage.Current.SetValue(key, value); var v = CrossSecureStorage.Current.GetValue(key); if ( v != value ) throw new Exception("R: " + r + ", Value: " + (v ?? "(null)") + ", orig: " + (value ?? "(null)"));

Output: R: False, Value: (null), orig: test

Hopefully, it's a mistake I am making; if so, I apologize for taking your time.

Thanks

Doublebock avatar Jan 12 '18 20:01 Doublebock

Having the same issue, I'm currently using version 2.0.0. Tried downgrading to another version but the issue seems to remain.

ghost avatar Jan 20 '18 20:01 ghost

Does it work on the iPhone/iPad, but not on the simulator? If so, it can be this issue: https://github.com/sameerkapps/SecureStorage/issues/9

sameerkapps avatar Jan 21 '18 16:01 sameerkapps

For those who still face troubles, follow these steps: 1- Right click on the iOS project, click Options. 2- Custom Entitlements: Entitlements.plist Custom Resource Rules: Info.plist image

3- Done. It should work now.

I assumed that you already checked Enable Keychain in Entitlements.plist: screen shot 2018-02-16 at 2 58 14 pm

ibrahimmd90 avatar Feb 16 '18 11:02 ibrahimmd90

Thanks @ibrahimmd90 for your input. @NielsWillems @Doublebock if this issue is addressed, please close it.

sameerkapps avatar Feb 19 '18 00:02 sameerkapps

The Issues still affects me even after I completed the steps you mentioned.

iPhone X iOS 11.2 Simulator Xamarin.Forms 2.5.0.280555 SecureStorage 2.0.1

ValonK avatar Feb 24 '18 12:02 ValonK

@sameerkapps After creating a test project in Xcode to generate a provisioning profile for the identifier it seems to be working on the simulator as well. I already had the keychain access group + custom entitlements set up. Cheers!

ghost avatar Feb 25 '18 16:02 ghost

@sameerkapps I am also facing the same issue, Get always return null, I am using iOS Simulator 11.3 and Secure Storage Version 2.0.2. Please help me.

Dodda avatar May 03 '18 10:05 Dodda

Please check the latest package 2.5.0. It sets KeyChain access level at AfterFirstUnlock as default.

sameerkapps avatar May 21 '18 03:05 sameerkapps

I am facing the same issue, I am using iOS Simulator 11.3 and Secure Storage Version 2.5.0.

devinZhou102 avatar Jun 05 '18 15:06 devinZhou102

Same here

RudolfVonKrugstein avatar Jun 07 '18 23:06 RudolfVonKrugstein

Same :-)

holm-dk avatar Jun 12 '18 07:06 holm-dk

Having the same issue running v 2.5.0. NetStandard 2. Entitlements enabled as described above.

codebeaulieu avatar Jun 22 '18 20:06 codebeaulieu

I tried Secure Storage sample with iOS Simulator 11.3, secure storage 2.5.0 and Xamarin forms 3.0.0.482510. Could not repro with the sample. Have you tried using secure storage sample? Also, can you please upload/send me the one that does not work? Thanks.

sameerkapps avatar Jun 24 '18 05:06 sameerkapps

I was having the same issue. Installed my application using Secure Storage v 2.0 with a password.

Then updated the application to v 2.5 without a password. Could not retrieve values from Secure Storage.

Deleting the application did not resolve the problem. I believe this is because iOS does not remove the keychain even when the application is uninstalled.

I use a iPod for my test device. I did a device wipe and reinstall. Problem solved!

PlymouthRock avatar Jul 18 '18 12:07 PlymouthRock