Objective c 关闭视图控制器时出错

Objective c 关闭视图控制器时出错,objective-c,uiviewcontroller,dismiss,Objective C,Uiviewcontroller,Dismiss,我创建了一个iPhone应用程序,它运行正常。所以,我为iPad实现了代码,问题就开始了。问题:当显示视图时,它不会关闭,应用程序停止。显示视图的代码是: - (IBAction)goToSetView { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil]; UIViewController *viewController = [storyboard instanti

我创建了一个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];
    }
}
关闭视图的代码是:

- (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。 我已经尝试重置模拟器,但仍然无法工作。
附言:你认为我需要重新安装xcode吗?谢谢。

您是否也在为iPad使用情节提要?是的,我正在为iPad使用情节提要。