Iphone iOS-执行到MPMoviePlayerServiceController的序列时执行错误访问
我正在使用故事板- 我对这个很陌生- 当我单击指向MPMoviePlayServiceController的按钮时,我收到一个Iphone iOS-执行到MPMoviePlayerServiceController的序列时执行错误访问,iphone,ios,xcode,ios6,storyboard,Iphone,Ios,Xcode,Ios6,Storyboard,我正在使用故事板- 我对这个很陌生- 当我单击指向MPMoviePlayServiceController的按钮时,我收到一个EXC\u BAD\u访问(code=2,address=0x4)错误 让您了解到目前为止我所掌握的知识:我有几个不同的ViewController都在同一个ViewController下。h/m类的导航由NavigationController控制。我从一个NavController和一个ViewController开始,用简单的CTRL单击按钮将新的ViewContr
EXC\u BAD\u访问
(code=2
,address=0x4
)错误
让您了解到目前为止我所掌握的知识:我有几个不同的ViewController
都在同一个ViewController
下。h/m类的导航由NavigationController
控制。我从一个NavController
和一个ViewController
开始,用简单的CTRL单击按钮将新的ViewControllers
链接到新的ViewController
。我添加了一个新的ViewController
;在Identity Inspector的“自定义类”部分中,将其类更改为MPMoviePlayServiceWController
,但当我单击按钮开始转换时,不断出现此错误
这是我的ViewController.h
代码(如果相关):
- (IBAction)postToTwitter:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"Check this out!"];
[self presentViewController:tweetSheet animated:YES completion:nil];
}
}
- (IBAction)postToFacebook:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"Posted from IOS App Test -- It works!"];
[self presentViewController:controller animated:YES completion:Nil];
}
}
- (IBAction)playVideo1:(id)sender {
NSURL * url = [[NSURL alloc]initWithString:@"link omitted"];
//create our moviePlayer
moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:url];
[self.view addSubview:moviePlayer.view];
//Some additional customization
moviePlayer.fullscreen = YES;
moviePlayer.allowsAirPlay = YES;
moviePlayer.shouldAutoplay = NO;
moviePlayer.controlStyle = MPMovieControlStyleDefault;
}
moviePlayer的
@property
声明是什么?-下面是IBOutlet
@richtoley代码,但在问题发生之前,甚至没有访问moviePlayer。我只是想访问mpmovieplayervcontrollercode
@属性(非原子,强)mpmovieplayervcontroller*moviePlayer;-(iAction)PostToWitter:(id)发送方;-(iAction)postToFacebook:(id)发件人;-(iAction)播放视频1:(id)发送方code
抱歉,我不知道该如何在这些评论中添加换行符您似乎有2个MPMoviePlayerController
s-一个以编程方式分配为ivar的普通视图控制器,它的视图是vc主视图的子视图,一个连接在故事板上,带有某种segue——可能是推式segue,因为您使用的是导航控制器。这两个看起来并不相连,所以如果你的segue被触发,可能问题在于故事板中的一个没有被设置。我假设segue按钮也连接到-playVideo
?不在segue上调用playVideo;我想我只是误解了mpmovieplayervewcontroller的正确用法。我想更好的问题是如何用我设置其他一切的方式实现MPMVC。我要抛开这个特殊的问题,换一种方式来解决它。谢谢你的帮助。