keychain - KeychainWrapperItem stopped working in iOS 7.1 -
i installed ios 7.1 simulator , new xcode 5.1. app worked in ios 7 fine. i'm using keychainitemwrapper class apple. after update crashed following message:
*** assertion failure in -[keychainitemwrapper writetokeychain] specifically @ line 299:
nsassert( result == noerr, @"couldn't update keychain item." ); error hear -25300 (errsecitemnotfound)
i have specified keychain access group in entitlements file. error occurred in ios 7.1 simulator , not on real iphone or 7.0 simulator.
does know changed keychain in 7.1 ?
well keychainitemwrapper old implementation full of bugs. recommend using wrapper, or write own.
that being said, used have many error not one. happens while saving checks item in keychain, in order add or update it. here check returns true though item quite different, cannot update because secitemupdate believes not exist.
what should reset keychain, have 2 options :
on simulator menu simulator->reset content , settings
run snippet somewhere in code :
based on vegard answer here reset iphone app's keychain
-(void)resetkeychain { [self deleteallkeysforsecclass:ksecclassgenericpassword]; [self deleteallkeysforsecclass:ksecclassinternetpassword]; [self deleteallkeysforsecclass:ksecclasscertificate]; [self deleteallkeysforsecclass:ksecclasskey]; [self deleteallkeysforsecclass:ksecclassidentity]; } -(void)deleteallkeysforsecclass:(cftyperef)secclass { nsmutabledictionary* dict = [nsmutabledictionary dictionary]; [dict setobject:(__bridge id)secclass forkey:(__bridge id)ksecclass]; osstatus result = secitemdelete((__bridge cfdictionaryref) dict); nsassert(result == noerr || result == errsecitemnotfound, @"error deleting keychain data (%ld)", result); }
Comments
Post a Comment