我在看起来像是来自 AVPlayerItem 的回调中遇到了崩溃。我这样设置通知:
if (queuePlayer==nil) {
queuePlayer = [[AVQueuePlayer alloc] initWithItems:playerItems];
}
else {
for (AVPlayerItem* item in playerItems) {
[queuePlayer insertItem:item afterItem:nil];
}
}
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerLastItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[playerItems lastObject]];
[queuePlayer play];
[playerItems release];
我以随机方式遇到此崩溃;这意味着大多数时候,代码都有效。但它会不时生成此堆栈跟踪。
线程 0 名称:调度队列:com.apple.main-thread 线程 0 崩溃:
0 libsystem_kernel.dylib 0x30fbd350 __pthread_kill + 8
1 libsystem_c.dylib 0x3916a11e pthread_kill + 54
2 libsystem_c.dylib 0x391a696e abort + 90
3 libc++abi.dylib 0x32515d4a abort_message + 70
4 libc++abi.dylib 0x32512ff4 default_terminate() + 20
5 libobjc.A.dylib 0x336c9a74 _objc_terminate() + 144
6 libc++abi.dylib 0x32513078 safe_handler_caller(void (*)()) + 76
7 libc++abi.dylib 0x32513110 std::terminate() + 16
8 libc++abi.dylib 0x3251450e __cxa_throw + 118
9 libobjc.A.dylib 0x336c99ba objc_exception_throw + 90
10 CoreFoundation 0x353bce02 -[NSObject(NSObject) doesNotRecognizeSelector:] + 166
11 CoreFoundation 0x353bb52c ___forwarding___ + 388
12 CoreFoundation 0x35312f64 _CF_forwarding_prep_0 + 20
13 CoreFoundation 0x3530a034 _CFXNotificationPost + 1424
14 AVFoundation 0x317e6d60 __avplayeritem_fpItemNotificationCallback_block_invoke_0 + 3364
15 libdispatch.dylib 0x340aa11c _dispatch_call_block_and_release + 8
16 libdispatch.dylib 0x340a94b4 _dispatch_client_callout + 20
17 libdispatch.dylib 0x340ae1b8 _dispatch_main_queue_callback_4CF$VARIANT$mp + 220
18 CoreFoundation 0x3538cf36 __CFRunLoopRun + 1286
19 CoreFoundation 0x352ffeb8 CFRunLoopRunSpecific + 352
20 CoreFoundation 0x352ffd44 CFRunLoopRunInMode + 100
21 GraphicsServices 0x3583c2e6 GSEventRunModal + 70
22 UIKit 0x366de2fc UIApplicationMain + 1116
23 Training 0x0004399a main (main.m:14)
24 Training 0x0004395c start + 36