Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 调用'时的EXC#u错误访问(代码2);presentViewController';_Ios_Objective C_Cocoa Touch_Uiviewcontroller_Nszombie - Fatal编程技术网

Ios 调用'时的EXC#u错误访问(代码2);presentViewController';

Ios 调用'时的EXC#u错误访问(代码2);presentViewController';,ios,objective-c,cocoa-touch,uiviewcontroller,nszombie,Ios,Objective C,Cocoa Touch,Uiviewcontroller,Nszombie,我真的被难住了 _vc = [[VLCKitViewControlleriPhone alloc]initWithNibName:@"VLCKitViewControlleriPhone" bundle:nil]; _vc.modalPresentationStyle = UIModalPresentationFullScreen; [self presentViewController:_vc animated:YES completion:nil]; 调用presentViewContro

我真的被难住了

_vc = [[VLCKitViewControlleriPhone alloc]initWithNibName:@"VLCKitViewControlleriPhone" bundle:nil];
_vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:_vc animated:YES completion:nil];
调用presentViewController方法时,为我提供EXC\u BAD\u访问权限(代码=2,地址=0x0)。视图控制器不是零。有或没有nib名称也会发生这种情况。如果我注释掉presentViewController行,代码的其余部分将继续正常运行,包括对视图控制器本身进行的方法调用。视图控制器正在运行,我只是看不到任何东西,因为它实际上没有显示视图

我启用了NSZombies,并在仪器运行的情况下进行了尝试,但没有显示任何内容。应用程序刚刚退出,仪器停止,没有给我任何信息。有人知道问题出在哪里吗?

你可以试试这个

if ([controller respondsToSelector:@selector(setModalPresentationStyle:)])
{
    [controller setModalPresentationStyle:UIModalPresentationFullScreen];
} else {
    [controller setModalPresentationStyle:UIModalPresentationFormSheet];
}

是否向控制台写入了任何内容?您是否尝试过在VLCKitViewControlleriPhone的viewDidLoad/WillAspect/DidAspect方法上设置断点,以查看它是否达到了这一程度?您的
VLCKitViewControlleriPhone
是否具有
xib
?(因为,你说如果它有或没有
nib
名称,听起来很奇怪。如果我没记错的话,如果xib不存在,它会显示一个错误。如果你在iPod/iPhone上运行,你不能使用UIModalPresentationFullScreen。这只适用于iPad。试着使用UIModalTransitionStyleCovertical,UIModalTransitionStyleFlipHorizontal、UIModalTransitionStyleCrossDissolve、UIModalTransitionStylePartialCurl如果使用iPhone回答上述问题:1)没有向控制台写入任何内容,2)它完全通过ViewDidLoad/Views显示,没有问题,3)XIB文件实际上存在,4)我尝试了各种方法,但似乎没有什么不同。这个答案毫无意义。您正在检查
controller
是否响应
setModalPresentationStyle:
并在响应时调用它,这很好。但如果它没有反应,你仍然用不同的论点来称呼它。如果它没有响应选择器,那么使用不同的参数调用该选择器不会使它神奇地响应