Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with iOS8 & XCode 6 #18

Open
christo-san opened this issue Jun 3, 2014 · 18 comments
Open

Error with iOS8 & XCode 6 #18

christo-san opened this issue Jun 3, 2014 · 18 comments

Comments

@christo-san
Copy link

Any saving within your basic "FXKeychainExample" app results in "FXKeychain failed to store data for key 'password', error: -34018" - Works just fine in XCode 5/iOS 7.0/7.1

This error occurs when running in simulator. It works fine on an actual device. Any clue what the issue may be?

@sgoodwin
Copy link

sgoodwin commented Jun 9, 2014

I'm also seeing this problem. Poking around in the code doesn't seem to be revealing much.

@sgoodwin
Copy link

sgoodwin commented Jun 9, 2014

This seems to help here: https://devforums.apple.com/message/973706#973706

@nicklockwood
Copy link
Owner

Can you try the latest version and see if that fixes it? Just found a bug that could have had all kinds of side effects, possibly including this one.

@MPiccinato
Copy link

I get this error also from time to time. I can't find a way to reproduce it though. My interface to Get and Set objects is pretty simple.

+ (BOOL)setObjectForThisDevice:(id)object forKey:(id)key
{
    FXKeychain* keyChain = [[FXKeychain alloc] initWithService:[[NSBundle mainBundle] bundleIdentifier]
                                                   accessGroup:nil
                                                 accessibility:FXKeychainAccessibleAlwaysThisDeviceOnly];

    return [keyChain setObject:object forKey:key];
}

+ (id)objectForThisDeviceForKey:(id)key
{
    FXKeychain* keyChain = [[FXKeychain alloc] initWithService:[[NSBundle mainBundle] bundleIdentifier]
                                                   accessGroup:nil
                                                 accessibility:FXKeychainAccessibleAlwaysThisDeviceOnly];

    return [keyChain objectForKey:key];
}

@kronik
Copy link

kronik commented Oct 30, 2014

I have same issue and I can reproduce it in 90% cases:

  1. Open app.
  2. Set value
  3. Put app into background
  4. Start timer with 10-20 sec timeout and in handler try to read the same value from keychain
  5. Lock phone
  6. Unlock phone
  7. Wait for timer hander

Environment: iOS 8.1 iPhone5S/6 with passcode

@nicklockwood
Copy link
Owner

@kronik what value are you using for the accessibility parameter?

@edgartronic
Copy link

I'm having the same issue, both when I try to read from and store to the keychain. Happens intermittently but often enough. Steps to repro:

  1. Open app.
  2. Set value
  3. Put the app into the BG
  4. Let device go into sleep mode.
  5. Unlock phone and bring the app into the foreground.
  6. Try to access the value set in step 2.

For reference, I'm using 'FXKeychainAccessibleAlwaysThisDeviceOnly' as my accessibility option, and I'm using the 'defaultKeychain' singleton instance instead of my own.

EDIT: There's a long thread about error -34018 on the Apple Dev Forums: https://devforums.apple.com/thread/254300

@bonebox
Copy link

bonebox commented Nov 26, 2014

I'm also having this issue with the latest version of FXKeychain on actual devices. Happens when the app is in the background for an indefinite amount of time. I'm also experiencing the reverse problem where data that was stored and previously retrieved successfully suddenly starts returning NULL values.

@sarperdag
Copy link

Any news on this? Getting this error on actual device and causing quite a big problem here...

@nicklockwood
Copy link
Owner

The conclusion I'm seeing everywhere is that this is a bug in Keychain, that there's no fix for for it, and that you just have to work around. The exact same bug was reported on SSKeychain and he closed it with a message to that effect :-/

soffes/SAMKeychain#52

I'm sorry, I know that's a terrible answer, but I don't have much to add. If it would be useful for me to surface the error, or handle it in a different way so you are better able to recover, let me know, but it seems that's all I can do until/unless Apple fixes it.

@sarperdag
Copy link

This is really bad. Any idea when it started occurring? After iOS8?

@nicklockwood
Copy link
Owner

Seems to have been an issue in iOS 7 as well. People claimed it was fixed and re-introduced various times, but it may just be because it was sporadic and hard to reproduce consistently.

@sarperdag
Copy link

All right thanks Nick.

Hating Apple these days...

@elviin
Copy link

elviin commented Apr 16, 2015

I just add my experience. Since I have updated to XCode 6.3 I am getting this error almost regularly. Before I did not see the error at all. What is the workaround for this issue?

@kitgary
Copy link

kitgary commented May 5, 2015

Help. It always return "FXKeychain failed to retrieve data for key" error, any way to solve?

@rashidasgari
Copy link

Hi everyone, i just found out the this only happens when im running the app directly from xcode.

@sa19gh84
Copy link

Hi All, This is True, I have this issue when I am testing the app with debugger (directly from Xcode) but it works charming without connecting to Xcode.

@TienVu-PW
Copy link

Running app in simulator just doesn't work at all...always got this error -34018, but work fine in real devices, really weird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests