0
我想在相當簡單的iPhone應用程序中使用MPMoviePlayerController
。基本佈局是與UIWindow
xib文件關聯的UIApplicationDelegate
。內applicationDidFinishLaunching
方法,我試圖播放電影用下面的代碼:MPMoviePlayerController堆棧溢出
// Path to the movie
NSString *path = [[NSBundle mainBundle] pathForResource:@"logoscreen" ofType:@"m4v"];
movieURL = [NSURL fileURLWithPath:path];
// Setup the player
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
// Use the new 3.2 style API
moviePlayer.controlStyle = MPMovieControlStyleNone;
moviePlayer.shouldAutoplay = YES;
[window addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
當此執行,我得到一個「EXC_BAD_ACCESS」錯誤,並且GDB加載一個巨大的堆棧(用「_makeSubtreePerformSelector」方法重複幾千次。
#6633 0x34b0cb0c in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
#6634 0x34b0cb0c in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
#6635 0x34b0cb0c in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
#6636 0x34b0cb0c in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
#6637 0x34b0c9c4 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:]
#6638 0x34b0c790 in -[UIView(Internal) _addSubview:positioned:relativeTo:]
#6639 0x34b0c408 in -[UIView(Hierarchy) addSubview:]
#6640 0x33f81928 in -[MPInlineVideoViewController _transitionToFullscreenAnimated:]
#6641 0x33f7df5c in -[MPInlineVideoViewController setFullscreen:animated:]
#6642 0x33f05998 in -[MPMoviePlayerControllerNew setFullscreen:animated:]
#6643 0x33f059cc in -[MPMoviePlayerControllerNew setFullscreen:]
#6644 0x33f06b2c in -[MPMoviePlayerController setFullscreen:]
#6645 0x00002ab0 in -[GiyapLiteAppDelegate playMovie:] at GiyapLiteAppDelegate.m:67
#6646 0x000028a2 in -[GiyapLiteAppDelegate applicationDidFinishLaunching:] at GiyapLiteAppDelegate.m:38
#6647 0x34b16154 in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:]
#6648 0x34cc46d4 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:]
#6649 0x34b7f7c0 in -[UIApplication handleEvent:withNewEvent:]
#6650 0x34b7eebc in -[UIApplication sendEvent:]
#6651 0x34b7e7f0 in _UIApplicationHandleEvent
#6652 0x33910ee4 in PurpleEventCallback
#6653 0x322352b2 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
#6654 0x322371dc in __CFRunLoopDoSource1
#6655 0x32238194 in __CFRunLoopRun
#6656 0x321df0c2 in CFRunLoopRunSpecific
#6657 0x321defd0 in CFRunLoopRunInMode
#6658 0x34b0ab20 in -[UIApplication _run]
#6659 0x34b08fc0 in UIApplicationMain
#6660 0x000026f8 in main at main.m:14
值得一提的是,如果我嘗試播放基於點擊事件電影的代碼,它工作得很好這幾乎就像應用程序沒有完成的「佈線」的東西但關於窗口層次?有沒有人遇到過這樣的事情?
感謝您的答覆 - 這似乎沒有工作,同樣的錯誤。然後,我嘗試將上面的所有「YES」值設置爲「NO」,並且我能夠實現的最佳結果是電影不能播放。 – Marty 2010-08-25 11:51:05