简体   繁体   English

MPMoviePlayerController堆栈溢出

[英]MPMoviePlayerController Stack Overflow

I'm trying to use MPMoviePlayerController in a fairly simple iPhone app. 我正在尝试在一个相当简单的iPhone应用程序中使用MPMoviePlayerController The basic layout is an UIApplicationDelegate associated with a UIWindow xib file. 基本布局是与UIWindow xib文件关联的UIApplicationDelegate Within the applicationDidFinishLaunching method, I'm trying to play a movie with the following code: applicationDidFinishLaunching方法中,我正在尝试使用以下代码播放电影:

// 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];  

When this executes, I get an "EXC_BAD_ACCESS" error, and the GDB loads a huge stack (with the "_makeSubtreePerformSelector" method repeating several thousand times: 执行此操作时,出现“ 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

It's worth noting that if I try the code that plays the movie based on a click event, it works just fine. 值得注意的是,如果我尝试基于click事件播放电影的代码,则可以正常工作。 It's almost like the application hasn't finished "wiring" something up yet in regards to the window hierarchy? 就好像应用程序尚未完成有关窗口层次结构的“接线”工作一样? Has anyone encountered anything like this before? 有人遇到过这样的事情吗?

也许您应该尝试将animated设置为否。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM