2011-04-27 165 views
0

这是我尝试使用的MPMoviePlayerController做:的MPMoviePlayerController问题

NSString *url = [[NSBundle mainBundle] pathForResource:@"IntroVideo" ofType:@"mp4"]; 
     MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]]; 

     [[NSNotificationCenter defaultCenter] addObserver:self 
               selector:@selector(moviePlayBackDidFinish:) 
                name:MPMoviePlayerPlaybackDidFinishNotification 
                object:nil]; 

     moviePlayer.scalingMode=MPMovieScalingModeAspectFill; 
     [[moviePlayer view] setBounds:CGRectMake(0, 0, 400, 400)]; 
     [[moviePlayer view] setCenter:CGPointMake([UIScreen mainScreen].bounds.size.width/2 , [UIScreen mainScreen].bounds.size.height/2 + 10)]; 
     [[moviePlayer view] setTransform:CGAffineTransformMakeRotation(M_PI/2)];  
     [self addSubview:moviePlayer.view]; 
     moviePlayer.controlStyle = MPMovieControlStyleNone; 
    [moviePlayer play]; 

MPMoviePlayerController是越来越坠毁后,我呼吁MPMoviePlayerController实例发挥。以下是崩溃日志。

请指导我解决这个问题。

-[__NSDictionary0 retain]: message sent to deallocated instance 0x5c1a0e0 

#0 0x0137a057 in ___forwarding___() 
#1 0x01379f22 in __forwarding_prep_0___() 
#2 0x0135287f in -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]() 
#3 0x01369946 in -[NSDictionary initWithObjectsAndKeys:]() 
#4 0x003877ff in -[MPAVController _itemWillChangeNotification:]() 
#5 0x00dcc6c1 in _nsnote_callback() 
#6 0x013e0f99 in __CFXNotificationPost_old() 
#7 0x0136033a in _CFXNotificationPostNotification() 
#8 0x00dc2266 in -[NSNotificationCenter postNotificationName:object:userInfo:]() 
#9 0x01de35b2 in -[NSObject(NSObject_AVShared) postNotificationWithDescription:]() 
#10 0x01de7b07 in -[AVController currentItemWillChangeToItem:oldItemCurrentTime:]() 
#11 0x01dea09e in -[AVController avPlaybackQueueCurrentItemChangedNotification:]() 
#12 0x01de83b8 in -[AVController setQueueFeeder:withIndex:]() 
#13 0x003846c5 in -[MPAVController reloadFeederWithStartQueueIndex:]() 
#14 0x0036d318 in -[MPMoviePlayerControllerNew _prepareToPlayWithStartIndex:]() 
#15 0x0036a88f in -[MPMoviePlayerControllerNew prepareToPlay]() 
#16 0x0036a7c5 in -[MPMoviePlayerControllerNew play]() 
#17 0x00dcc6c1 in _nsnote_callback() 
#18 0x013e0f99 in __CFXNotificationPost_old() 
#19 0x0136033a in _CFXNotificationPostNotification() 
#20 0x00dc2266 in -[NSNotificationCenter postNotificationName:object:userInfo:]() 
#21 0x00dce5a9 in -[NSNotificationCenter postNotificationName:object:]() 
#22 0x003febcf in -[MPMovie _determineMediaType]() 
#23 0x00de17f6 in __NSFireDelayedPerform() 
#24 0x013e9fe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__() 
#25 0x013eb594 in __CFRunLoopDoTimer() 
#26 0x01347cc9 in __CFRunLoopRun() 
#27 0x01347240 in CFRunLoopRunSpecific() 
#28 0x01347161 in CFRunLoopRunInMode() 
#29 0x01e4d268 in GSEventRunModal() 
#30 0x01e4d32d in GSEventRun() 
#31 0x0068242e in UIApplicationMain() 
#32 0x000023df in main (argc=1, argv=0xbfffed44) at main.m:14 
+0

你能提供一些代码吗?没有它,我们只能在这里尝试我们最好的猜测。 – changelog 2011-04-27 09:34:24

+1

请编辑你的问题,不用代码我们不能帮你。 – Tirth 2011-04-27 09:48:22

回答

1

我会用我的水晶球回答这个问题!

缺失部分是

*** -[NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil value 
*** Uncaught exception: <NSInvalidArgumentException> *** -[NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil value 

这意味着该URL不指向一个有效的电影

movieController = [[MPMoviePlayerController alloc] initWithContentURL:movieURL 

打完

[NSURL fileURLWithPath:moviePath] 

日志,并检查文件真的存在:

NSLog(@"%@", [url absoluteString]); 
+0

最后我解决了这个问题。 – Dee 2011-04-28 10:35:05

相关问题