2011-04-27 8 views
0

이 내가 MPMoviePlayerController를 사용하는 것을 시도하고있는 무슨이다 : 나는 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가 추락지고 있습니다. 아래는 충돌 로그입니다.

이 문제를 해결하려면 안내하십시오.

-[__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

+1

우리는 당신을 도울 수없는 코드없이 질문을 편집하십시오. – Tirth

답변

1

나는 내 수정 구슬을 사용하여 이것을 대답 할 것입니다!

누락 된 부분은

[NSURL fileURLWithPath:moviePath] 

로그 후 너무

movieController = [[MPMoviePlayerController alloc] initWithContentURL:movieURL 

에 유효한 영화를 가리키고 있는지 확인하지 않는 URL을 의미

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

입니다 파일이 실제로 있습니다.

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

마지막으로 나는이 문제를 해결했다. – Dee