- 我正在开发一个需要与 cocoalibspotify 集成的项目。对于导入 CocoaLibSpotify.h 的类,我有一些单元测试用例。这些测试用例因以下堆栈跟踪而失败:
NSString* base::deviceIdFromKeychain()() 中的断言失败,/Users/spotify-buildagent/buildAgent/work/1e0ce8a77adfb2dc/client/base/_apple/_ios/os_ios.mm:287 2013-10-20 11:14:03.505 * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Keychain error when fetching device ID, nonrecoverable' * First throw call stack: (0x30f0cf53 0x3b2366af 0x30f0ce2d 0x318b41df 0x2d142f 0x2d1a09 0x2ce6db 0x17b1b5 0x1798b3 0x30ed81b9 0x30ed753b 0x30ed5e45 0x30e40ce7 0x30e84803 0x179b1d 0x318efe27 0x3b85dc1d 0x3b85db8f 0x3b85bc90) libc++abi.dylib:以 NSException 类型的未捕获异常终止
抛出异常的方法在SPSession.m类中:CFRunLoopRun();
+(void)runBackgroundRunloop:(dispatch_block_t)runLoopReadyBlock {
@autoreleasepool {
[NSThread currentThread].name = @"com.spotify.CocoaLibSpotify";
[runloopReadyLock lock];
libspotify_runloop = CFRunLoopGetCurrent();
sleep(1);
libspotifyThread = [NSThread currentThread];
// Use a custom, no-op run loop source to keep the loop alive and fast.
CFRunLoopSourceContext libspotify_source_context;
memset(&libspotify_source_context, 0, sizeof(CFRunLoopSourceContext));
libspotify_runloop_source = CFRunLoopSourceCreate(NULL, 0, &libspotify_source_context);
CFRunLoopAddSource(libspotify_runloop, libspotify_runloop_source, kCFRunLoopDefaultMode);
[runloopReadyLock unlockWithCondition:1];
CFRunLoopRun();
CFRelease(libspotify_runloop_source);
CFRelease(libspotify_runloop);
libspotify_runloop_source = NULL;
libspotify_runloop = NULL;
libspotifyThread = nil;
}
}
我不知道是什么导致了错误或如何修复它。有人对此有任何想法吗?
谢谢,