FXKeychain icon indicating copy to clipboard operation
FXKeychain copied to clipboard

Error with iOS8 & XCode 6

Open christo-san opened this issue 11 years ago • 18 comments

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?

christo-san avatar Jun 03 '14 22:06 christo-san

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

sgoodwin avatar Jun 09 '14 13:06 sgoodwin

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

sgoodwin avatar Jun 09 '14 14:06 sgoodwin

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.

nicklockwood avatar Oct 12 '14 23:10 nicklockwood

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];
}

MPiccinato avatar Oct 23 '14 14:10 MPiccinato

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

kronik avatar Oct 30 '14 06:10 kronik

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

nicklockwood avatar Oct 30 '14 09:10 nicklockwood

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

edgartronic avatar Nov 18 '14 18:11 edgartronic

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.

bonebox avatar Nov 26 '14 15:11 bonebox

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

sarperdag avatar Jan 13 '15 14:01 sarperdag

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 :-/

https://github.com/soffes/sskeychain/issues/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.

nicklockwood avatar Jan 13 '15 14:01 nicklockwood

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

sarperdag avatar Jan 13 '15 14:01 sarperdag

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.

nicklockwood avatar Jan 13 '15 14:01 nicklockwood

All right thanks Nick.

Hating Apple these days...

sarperdag avatar Jan 13 '15 14:01 sarperdag

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?

elviin avatar Apr 16 '15 10:04 elviin

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

kitgary avatar May 05 '15 05:05 kitgary

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

rashidasgari avatar Oct 07 '15 12:10 rashidasgari

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.

sa19gh84 avatar Jul 12 '16 09:07 sa19gh84

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

TienVu-PW avatar Dec 06 '16 05:12 TienVu-PW