ios - Double KeyChainItemWrapper -


i have strange problem keychainitemwrapper.

i used create 2 of them so:

keychainitemwrapper *kcwrapper = [[keychainitemwrapper alloc] initwithidentifier:@"first" accessgroup:nil];  keychainitemwrapper *kcwrapper1 = [[keychainitemwrapper alloc] initwithidentifier:@"second" accessgroup:nil]; 

i set object this:

[kcwrapper setobject:@"something" forkey:(__bridge id)ksecvaluedata]; [kcwrapper1 setobject:@"something1" forkey:(__bridge id)ksecvaluedata]; 

this worked perfectly, until... nothing changed?

now error:

*** assertion failure in -[keychainitemwrapper writetokeychain], /users/wingair/documents/iosprojects/tulipstempelkort-  ios/stempelkort/../keychainitemwrapper.m:305 

line 305 is:

// no previous item found; add new one. result = secitemadd((__bridge cfdictionaryref)[self dictionarytosecitemformat:keychainitemdata], null);     nsassert( result == noerr, @"couldn't add keychain item." ); 

been stuck here quite long time, appreciated.

the writetokeychain function:

- (void)writetokeychain {     cfdictionaryref attributes = null;     nsmutabledictionary *updateitem = nil; osstatus result;     if (secitemcopymatching((__bridge cfdictionaryref)genericpasswordquery, (cftyperef *)&attributes) == noerr)     {     // first need attributes keychain.     updateitem = [nsmutabledictionary dictionarywithdictionary:(__bridge nsdictionary *)attributes];     // second need add appropriate search key/values.     [updateitem setobject:[genericpasswordquery objectforkey:(__bridge id)ksecclass] forkey:(__bridge id)ksecclass];      // lastly, need set updated attribute list being careful remove class.     nsmutabledictionary *tempcheck = [self dictionarytosecitemformat:keychainitemdata];     [tempcheck removeobjectforkey:(__bridge id)ksecclass];  [tempcheck removeobjectforkey:(__bridge id)ksecattraccessgroup];      // implicit assumption can update single item @ time.      result = secitemupdate((__bridge cfdictionaryref)updateitem, (__bridge cfdictionaryref)tempcheck);     nsassert( result == noerr, @"couldn't update keychain item." ); 


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -