Это то, что я пытаюсь сделать с помощью 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
падает после того, как я вызываю 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