Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaPlayer crash on iOS 7.1 (MPAVItem)

I'm using a UIWebview to play YouTube video on my iOS app, after iOS 7.1 release, I got lots of following crash report:

Exception Type:  EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  1

Thread 0:
0   libobjc.A.dylib                 0x393dd637 objc_msgSend + 23
1   Foundation                      0x2f563d57 +[NSConcreteNotification     newTempNotificationWithName:object:userInfo:] + 119
2   Foundation                      0x2f563ca9 -[NSNotificationCenter     postNotificationName:object:userInfo:] + 45
3   Foundation                      0x2f5685c3 -[NSNotificationCenter     postNotificationName:object:] + 27
4   MediaPlayer                     0x2feb17b9 __53-[MPAVItem     _playerItemNewAccessLogEntryNotification:]_block_invoke + 69
5   libdispatch.dylib               0x398bcd51 _dispatch_call_block_and_release + 9
6   libdispatch.dylib               0x398bcd3d _dispatch_client_callout + 21
7   libdispatch.dylib               0x398bf6bf _dispatch_main_queue_callback_4CF + 275
8   CoreFoundation                  0x2ec0d675 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 5
9   CoreFoundation                  0x2ec0bf41 __CFRunLoopRun + 1305
10  CoreFoundation                  0x2eb767a5 CFRunLoopRunSpecific + 521
11  CoreFoundation                  0x2eb76587 CFRunLoopRunInMode + 103
12  GraphicsServices                0x33ad36cf GSEventRunModal + 135
13  UIKit                           0x314d588d UIApplicationMain + 1133
14  myApp                           0x000eb679 0xe7000 + 18041
15  myApp                           0x000eb5c4 0xe7000 + 17860

Thread 1 Crashed:
0   libsystem_kernel.dylib          0x39975804 kevent64 + 24
1   libdispatch.dylib               0x398c4051 _dispatch_mgr_invoke + 229
2   libdispatch.dylib               0x398be2df _dispatch_mgr_thread + 35

Maybe the OS is trying to post a notification to an object that doesn't exist anymore. I didn't use MBAVItem directly, so it should be called while UIWebview is playing YouTube video. According iTunes connect, this crash just happened on iOS 7.1 (at least for now) and become the most frequent crash.

like image 734
Carlos Chen Avatar asked Mar 26 '14 00:03

Carlos Chen


1 Answers

I used to create new YouTube HTML player for each song, and this crash happens after playing 5 - 10 songs.

After doing some experiments, this crash can be avoided by loading different songs with same YouTube HTML player (don't create a new one, just call loadVideoById()), hope this answer can help someone =)

like image 188
Carlos Chen Avatar answered Sep 27 '22 16:09

Carlos Chen