ios Keychain KeychainItemWrapper

部分真机报Couldn't add the Keychain Item.
源码:
KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"UserId" accessGroup:nil];
[wrapper setObject:[NSString stringWithFormat: @"%ld", (long)user_id] forKey: (__bridge_transfer id)(kSecValueData)];

Couldn't add the Keychain Item.
(null)
(
0 CoreFoundation 0x0000000182ee42f4 + 160
1 libobjc.A.dylib 0x00000001946b80e4 objc_exception_throw + 60
2 CoreFoundation 0x0000000182ee4198 + 0
3 Foundation 0x0000000183d98ed4 + 112
4 ziyou 0x10007ea38 -[KeychainItemWrapper writeToKeychain] + 732
5 ziyou 0x10007e0c4 -[KeychainItemWrapper setObject:forKey:] + 200
6 ziyou 0x10002dc9c +[Utility setKeyChainUserId:] + 248
7 ziyou 0x10007bc74 __29-[AppDelegate registerUserId]_block_invoke + 648
8 ziyou 0x1000389c4 __64-[UserApi registerUser:andInstallationId:andCheckCode:andblock:]_block_invoke + 264
9 ziyou 0x1000cd1e4 __64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke46 + 56
10 libdispatch.dylib 0x0000000194d09994 + 24
11 libdispatch.dylib 0x0000000194d09954 + 16
12 libdispatch.dylib 0x0000000194d0e20c _dispatch_main_queue_callback_4CF + 1608
13 CoreFoundation 0x0000000182e9b7f8 + 12
14 CoreFoundation 0x0000000182e998a0 + 1492
15 CoreFoundation 0x0000000182dc52d4 CFRunLoopRunSpecific + 396
16 GraphicsServices 0x000000018c5e36fc GSEventRunModal + 168
17 UIKit 0x000000018798afac UIApplicationMain + 1488
18 ziyou 0x10002ece8 main + 124
19 libdyld.dylib 0x0000000194d36a08 + 4
)

阅读 2.9k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏