I'm really stumped here.

_vc = [[VLCKitViewControlleriPhone alloc]initWithNibName:@"VLCKitViewControlleriPhone" bundle:nil];
_vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:_vc animated:YES completion:nil];

Gives me EXC_BAD_ACCESS (code = 2, address = 0x0) when the presentViewController method is called. The view controller is NOT nil. It also happens with or without a nib name. If I comment out the presentViewController line, the rest of the code continues fine, including method calls made to the view controller itself. The view controller is running, I just can't see anything because it's not actually showing the view.

I enabled NSZombies and tried it with Instruments running, but it's not showing me anything. The app just quits and instruments stops without giving me any information. Anyone know what the problem might be?

有帮助吗?

解决方案

You can try this

if ([controller respondsToSelector:@selector(setModalPresentationStyle:)])
{
    [controller setModalPresentationStyle:UIModalPresentationFullScreen];
} else {
    [controller setModalPresentationStyle:UIModalPresentationFormSheet];
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top