Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.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 7 presentViewController显示黑屏和SIGABRT_Ios_Objective C_Iphone - Fatal编程技术网

iOS 7 presentViewController显示黑屏和SIGABRT

iOS 7 presentViewController显示黑屏和SIGABRT,ios,objective-c,iphone,Ios,Objective C,Iphone,通过在方法[ViewDidLoad]中编写代码,我在右UIBARBUTTON上使用了两个按钮 我想使用+加号按钮移动到AddNameViewController,但它会导致失败[sigabrt] 我认为错误在下面的代码中 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; AddNameViewController *sfvc = [storyboard instan

通过在方法[ViewDidLoad]中编写代码,我在右UIBARBUTTON上使用了两个按钮

我想使用+加号按钮移动到AddNameViewController,但它会导致失败[sigabrt]

我认为错误在下面的代码中

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController.m"];
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:sfvc animated:YES completion:nil];
更改此项:

AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController.m"]
为此:

AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController"]
您需要的是视图控制器的名称,而不是文件。

更改此选项:

AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController.m"]
为此:

AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController"]

您需要的是视图控制器的名称,而不是文件。

正如Antonio所说,您需要视图控制器的正确标识符。它崩溃的原因是,您从实例化的ViewController返回了一个nil视图控制器指针,标识符:调用并将nil传递给presentViewController:animated:completion:导致崩溃。

正如Antonio所说,您需要视图控制器的正确标识符。它崩溃的原因是,您从InstanceViewController的标识符:调用中得到了一个nil视图控制器指针,并将nil传递给presentViewController:animated:completion:导致崩溃。

抱歉,在询问之前,我没有仔细检查。因为我尝试了很多方法来改进它。虽然我将AddNameViewController.m更改为AddNameViewController


它仍然显示sigabrt。

对不起,我在询问之前没有仔细检查。因为我尝试了很多方法来改进它。虽然我将AddNameViewController.m更改为AddNameViewController

它仍然显示sigabrt。

检查此项

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController"];
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:sfvc animated:YES completion:nil];
并在序列图像板ID中添加标识符AddNameViewController

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
AddNameViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"AddNameViewController"];
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:sfvc animated:YES completion:nil];

并在序列图像板ID中添加标识符AddNameViewController

AddNameViewController*sfvc=[storyboard InstanceEviewController标识符:@AddNameViewController.m];此处仅用您的标识符名称替换AddNameViewController.m。请不要使用扩展。对不起,[我在询问之前没有仔细检查。]因为我尝试了很多方法来改进它。虽然我将AddNameViewController.m更改为AddNameViewController。它仍然显示sigabrt。T^TAddNameViewController*sfvc=[情节提要实例化的EWController标识符:@AddNameViewController.m];此处仅用您的标识符名称替换AddNameViewController.m。请不要使用扩展。对不起,[我在询问之前没有仔细检查。]因为我尝试了很多方法来改进它。虽然我将AddNameViewController.m更改为AddNameViewController。它仍然显示sigabrt。T^T