ios - Assertion failure when trying to write data to Keychain -
i trying write array data keychain using code below
// set keychain can write it... or read if needed (specially testing) keychainitemwrapper* keychain = [[keychainitemwrapper alloc] initwithidentifier:@"keykeychain" accessgroup:nil]; // write nsdata *dataarr = [nskeyedarchiver archiveddatawithrootobject:parsedremotesitesmutablearray]; [keychain setobject:dataarr forkey:(__bridge id)(ksecattrgeneric)]; // read nsdata *myarr = [keychain objectforkey:(__bridge id)(ksecattrgeneric)]; nsarray *arraycopy = [nskeyedunarchiver unarchiveobjectwithdata:myarr]; // log nslog(@"%@", arraycopy);
as can see converting nsarray nsdata trying store nsdata ksecattrgeneric reciving error below when tri setobject:forkey
assertion failure in -[keychainitemwrapper writetokeychain], /users/imac/documents/iphone applications/appname/appname/keychainitemwrapper.m:268 2013-07-22 13:54:39.952 key[2167:907] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'couldn't add keychain item.' *** first throw call stack:etc...
any appreciated.
Comments
Post a Comment