我想知道你们中是否有人遇到过类似的问题,当然,他们碰巧找到了一个合适或不太合适的解决方案/解决方案。
我正在使用一个MPMoviePlayerViewController,我试图在MPMoviePlayerViewControllers视图上添加一个滑动手势识别器。
moviePlayerViewController = [MPMoviePlayerViewController allocinitWithContentURL:NSURL URLWithString:currentChannel.StreamURI];
moviePlayerViewController.moviePlayer setControlStyle:MPMovieControlStyleNone;
moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
moviePlayerViewController.moviePlayer.shouldAutoplay = YES;
moviePlayerViewController.moviePlayer setScalingMode: MPMovieScalingModeAspectFit;UISwipeGestureRecognizer *swipeGestureRight = [UISwipeGestureRecognizer alloc initWithTarget:self action:@selector(previousChannel)];
swipeGestureRight.direction = UISwipeGestureRecognizerDirectionRight;
myMoviePlayerViewController.view地址addGestureRecognizer:滑动swipeGestureRight;
self.view addSubview:moviePlayerViewController.view;
不管怎样,它“有点工作”,但是当我在运行中的电影播放器实例(无论是在模拟器中还是在设备上)上做手势来测试整个过程时,应用程序崩溃了,控制台状态
** -[CFRunLoopTimer invalidate]: message sent to deallocated instance 0xf074bb0你们中有谁对这个话题有什么想法吗?
发布于 2010-10-07 13:28:29
iOS似乎正在释放您的MPMoviePlayerViewController对象,然后稍后向它发送一条消息。我建议将实例作为类的成员,然后实例化它的属性,例如:
@property (nonatomic, retain) MPMoviePlayerViewController *moviePlayerViewController;...along与相应的@synthesize声明您的类的实现文件。在分配对象时,您应该这样做:
self.moviePlayerController = [[[MPMoviePlayerViewController alloc] initWithContentURL:@"yourUrl"] autorelease];最后,通过在您的nil方法中将对象设置为dealloc来释放它。
https://stackoverflow.com/questions/3060352
复制相似问题