我想NSArray
使用KeychainItemWrapper
类保存
我知道我们可以NSDictionary
在阅读此问题后存储
但它不工作
这是我到目前为止所做的
NSArray *myArray = [[NSArray alloc]initWithObjects:@"Hello1",@"Hello2",@"Hello3",@"Hello4", nil];
NSDictionary *myDic = [[NSDictionary alloc]initWithObjectsAndKeys:myArray, @"arrayKey", nil];
NSString *error;
NSData *dictionaryRep = [NSPropertyListSerialization dataFromPropertyList:myDic format:NSPropertyListXMLFormat_v1_0 errorDescription:&error];
KeychainItemWrapper *keychain =
[[KeychainItemWrapper alloc] initWithIdentifier:@"MyIdentifier" accessGroup:nil];
[keychain setObject:dictionaryRep forKey:(__bridge id)kSecValueData];
但它在我们设置对象的最后一行崩溃了。
错误日志:
2013-10-01 12:16:47.590 stackoverflowtry[3883:a0b] -[__NSCFData dataUsingEncoding:]: unrecognized selector sent to instance 0xa1686a0
2013-10-01 12:16:47.593 stackoverflowtry[3883:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData dataUsingEncoding:]: unrecognized selector sent to instance 0xa1686a0'
需要帮忙。