我创建了一个iPhone应用程序,它运行正常。所以,我实现了iPad的代码,问题就开始了。问题:当呈现视图时,它不会被解雇并且应用程序停止。显示视图的代码是:
- (IBAction)goToSetView
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"SetViewControllerIPhone"];
[self setModalPresentationStyle:UIModalPresentationCurrentContext];
[self presentViewController:viewController animated:NO completion:nil];
}
解除视图的代码是:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
if ([touch view] == self.view) {
[self dismissViewControllerAnimated:NO completion:nil];
}
}
错误是:
NewApp(2072,0x22e11a8) malloc: *** mach_vm_map(size=402657280) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
其他信息:在模拟器显示错误消息之前,它显示已用内存超过1,5GB。 我已经尝试重置模拟器,但它仍然无法正常工作。 P.S。:你认为我需要重新安装xcode吗?感谢。