我正在使用ExternalAccessory
FW 并能够将数据传递到外围设备。
我面临一个奇怪的情况,当我试图保存一些价值时,NSUserDefaults
我得到了这个(看起来)不相关的错误:
UISupportedExternalAccessoryProtocols = com.xxxxx.yyy.zz
2013-07-24 17:01:39.181 myApp[791:907] ERROR - opening session failed
2013-07-24 17:01:39.182 myApp[791:907] ERROR - /SourceCache/ExternalAccessory/ExternalAccessory-213.3/EASession.m:-[EASession dealloc] - 137 unable to close session for _accessory=0x2088cdb0 and sessionID=65536
并且与外围设备的连接已失效。
写入的代码NSUserDefaults
:
NSInteger transactionId = [[NSUserDefaults standardUserDefaults] integerForKey:kTransactionId];
transactionId = transactionId % NSIntegerMax + 1;
[[NSUserDefaults standardUserDefaults] setInteger:transactionId forKey:kTransactionId];
[[NSUserDefaults standardUserDefaults] synchronize];
如果我注释掉[[NSUserDefaults standardUserDefaults] setInteger:transactionId forKey:kTransactionId];
一切正常...
任何想法?