我遇到的问题是,当我通过App Store下载应用程序时,我正在使用MPMoviePlayerViewController播放的MP4正在崩溃我的应用程序。当通过xcode在设备上运行时,通过xcode在设备上运行,以及通过Test Flight安装在设备上时,同样的视频和相同的构建可以正常运行。
我已确认MP4文件包含在Build Phases中 - >复制捆绑资源。
我对xCode比较陌生,但是我已经看过崩溃报告,我相信我正在使用的fileURLWithPath存在问题,但是因为除了最后一次在App Store上以外它可以在任何地方工作,我是无法弄清楚我哪里出错了。
以下是我用于显示视频的代码:
- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar videoButton:(UIButton *)button {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Welcome-Crossings" ofType:@"mp4"]];
MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc]
initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:playercontroller];
playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[playercontroller.moviePlayer play];
playercontroller = nil;
}
以下是崩溃报告:
Incident Identifier: 3D4629BE-B963-4951-A24C-65CE56BA1B34
CrashReporter Key: 96a0c6b17b80f0a7287d9aede092906e03392cb4
Hardware Model: iPhone7,2
Process: AppName [4230]
Path: /private/var/mobile/Containers/Bundle/Application/XXX/AppName.app/AppName
Identifier: AppIdentifier
Version: 1 (1)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-04-02 10:16:57.016 -0400
Launch Time: 2015-04-02 10:16:55.151 -0400
OS Version: iOS 8.2 (12D508)
Report Version: 105
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x183ede530 __exceptionPreprocess + 132
1 libobjc.A.dylib 0x194eb40e4 objc_exception_throw + 60
2 CoreFoundation 0x183ede470 +[NSException raise:format:] + 128
3 Foundation 0x184d44c68 -[NSURL(NSURL) initFileURLWithPath:] + 136
4 Foundation 0x184d44bc8 +[NSURL(NSURL) fileURLWithPath:] + 56
5 AppName 0x100015324 0x100008000 + 54052
6 AppName 0x100027244 0x100008000 + 127556
7 UIKit 0x188720a14 -[UIApplication sendAction:to:from:forEvent:] + 96
8 UIKit 0x188709d08 -[UIControl _sendActionsForEvents:withEvent:] + 612
9 UIKit 0x1887203b0 -[UIControl touchesEnded:withEvent:] + 592
10 UIKit 0x18872003c -[UIWindow _sendTouchesForEvent:] + 700
11 UIKit 0x188719590 -[UIWindow sendEvent:] + 684
12 UIKit 0x1886ece60 -[UIApplication sendEvent:] + 264
13 UIKit 0x18898c46c _UIApplicationHandleEventFromQueueEvent + 15220
14 UIKit 0x1886eb3d0 _UIApplicationHandleEventQueue + 1716
15 CoreFoundation 0x183e96d34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
16 CoreFoundation 0x183e95fd8 __CFRunLoopDoSources0 + 264
17 CoreFoundation 0x183e94088 __CFRunLoopRun + 712
18 CoreFoundation 0x183dc11f4 CFRunLoopRunSpecific + 396
19 GraphicsServices 0x18d1e36fc GSEventRunModal + 168
20 UIKit 0x18875210c UIApplicationMain + 1488
21 AppName 0x100025f6c 0x100008000 + 122732
22 libdyld.dylib 0x195532a08 start + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000019564b270 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001956e916c pthread_kill + 108
2 libsystem_c.dylib 0x00000001955c2b14 abort + 108
3 libc++abi.dylib 0x0000000194681414 abort_message + 112
4 libc++abi.dylib 0x00000001946a0b88 default_terminate_handler() + 300
5 libobjc.A.dylib 0x0000000194eb43bc _objc_terminate() + 124
6 libc++abi.dylib 0x000000019469dbb0 std::__terminate(void (*)()) + 12
7 libc++abi.dylib 0x000000019469d738 __cxa_rethrow + 140
8 libobjc.A.dylib 0x0000000194eb4290 objc_exception_rethrow + 40
9 CoreFoundation 0x0000000183dc12a0 CFRunLoopRunSpecific + 568
10 GraphicsServices 0x000000018d1e36f8 GSEventRunModal + 164
11 UIKit 0x0000000188752108 UIApplicationMain + 1484
12 ...AppName 0x0000000100025f68 0x100008000 + 122728
13 libdyld.dylib 0x0000000195532a04 start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x0000000195630c24 kevent64 + 8
1 libdispatch.dylib 0x0000000195515e6c _dispatch_mgr_invoke + 272
2 libdispatch.dylib 0x0000000195507998 _dispatch_mgr_thread + 48
Thread 2 name: Dispatch queue: ReaderThumbWorkQueue :: NSOperation 0x174055600
Thread 2:
0 libsystem_kernel.dylib 0x0000000195630e0c mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000195630c84 mach_msg + 68
2 IOKit 0x00000001850c5eb0 io_connect_method + 360
3 IOKit 0x0000000185076078 IOConnectCallMethod + 228
4 IOSurface 0x000000018d8b2fc8 IOSurfaceClientWrapClientImage + 464
5 IOSurface 0x000000018d8b570c IOSurfaceWrapClientImage + 16
6 ImageIO 0x000000018519e0b0 createImageIOSurfaceWithFormat + 128
7 ImageIO 0x000000018516adf4 createImageBlockSetWithAspenHardwareDecode + 544
8 ImageIO 0x000000018519a6a8 copyImageBlockSetAppleJPEG + 5028
9 ImageIO 0x00000001850eb20c ImageProviderCopyImageBlockSetCallback + 780
10 CoreGraphics 0x0000000184134030 img_blocks_create + 372
11 CoreGraphics 0x0000000184125404 img_data_lock + 1288
12 CoreGraphics 0x00000001841244ec CGSImageDataLock + 136
13 libRIP.A.dylib 0x00000001844dd72c ripc_AcquireImage + 768
14 libRIP.A.dylib 0x00000001844dcb00 ripc_DrawImage + 600
15 CoreGraphics 0x000000018412421c CGContextDrawImage + 404
16 CoreGraphics 0x0000000184218450 CGPDFDrawingContextDrawImage + 292
17 CoreGraphics 0x000000018420ae38 op_Do + 148
18 CoreGraphics 0x0000000184249290 pdf_scanner_handle_xname + 112
19 CoreGraphics 0x0000000184248afc CGPDFScannerScan + 268
20 CoreGraphics 0x00000001841d1acc CGPDFDrawingContextDrawPage + 436
21 CoreGraphics 0x0000000184237ab8 pdf_page_draw_in_context + 104
22 CoreGraphics 0x00000001841c99b8 CGContextDrawPDFPage + 44
23 ...AppName 0x000000010000cee0 0x100008000 + 20192
24 Foundation 0x0000000184cfcec8 -[__NSOperationInternal _start:] + 632
25 Foundation 0x0000000184dbe948 __NSOQSchedule_f + 224
26 libdispatch.dylib 0x0000000195505950 _dispatch_client_callout + 12
27 libdispatch.dylib 0x00000001955100a0 _dispatch_queue_drain + 1444
28 libdispatch.dylib 0x0000000195508a58 _dispatch_queue_invoke + 128
29 libdispatch.dylib 0x0000000195512314 _dispatch_root_queue_drain + 716
30 libdispatch.dylib 0x0000000195513c48 _dispatch_worker_thread3 + 104
31 libsystem_pthread.dylib 0x00000001956e5228 _pthread_wqthread + 812
32 libsystem_pthread.dylib 0x00000001956e4eec start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x000000019564bc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001956e52d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001956e4eec start_wqthread + 0
Thread 4:
0 libsystem_kernel.dylib 0x000000019564bc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001956e52d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001956e4eec start_wqthread + 0
Thread 5:
0 libsystem_kernel.dylib 0x000000019564bc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001956e52d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001956e4eec start_wqthread + 0
Thread 6:
0 libsystem_kernel.dylib 0x000000019564bc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001956e52d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001956e4eec start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x00000001740f2137
x4: 0x00000001946a1dfd x5: 0x000000016fdf7370 x6: 0x000000000000006e x7: 0x0000000000000580
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000000000200 x11: 0x0000000000000000
x12: 0x0000000000000000 x13: 0x0000000000000000 x14: 0x0000000000000002 x15: 0x0000000000000000
x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x00000001996a3310 x21: 0x000000019968bce8 x22: 0x000000017415eaf0 x23: 0x0000000195b4bc80
x24: 0x0000000000000001 x25: 0x000000017415eae0 x26: 0x000000019968a0a8 x27: 0x0000000000000001
x28: 0x0000000000000000 fp: 0x000000016fdf72d0 lr: 0x00000001956e9170
sp: 0x000000016fdf72b0 pc: 0x000000019564b270 cpsr: 0x00000000
感谢您的帮助!