KeychainItemWrapper Crashing for iOS8

2019-04-10 07:11发布

问题:

I'm using KeychainItemWrapper for my application using the following line of code

KeychainItemWrapper *currentUser = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.example" accessGroup:nil];
[currentUser setObject:accountString forKey:CFBridgingRelease(kSecAttrAccount)];

accountString is a string containing my user information.

The code works perfectly fine with iOS7 but crashes with iOS8.

I'm not sure what i'm doing wrong., can someone please help!! I'm running the application on a simulator.

update: Here is the crash

* Assertion failure in -[KeychainItemWrapper writeToKeychain]

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'

回答1:

Looks like the first BETA version doesn't support Keychain Access developer APIs on the simulator. Hopefully this is brought in soon.

Update: looks like issue is fixed in Beta 2