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
Objective c 从情节提要加载的UIViewController内存异常_Objective C_Uiviewcontroller - Fatal编程技术网

Objective c 从情节提要加载的UIViewController内存异常

Objective c 从情节提要加载的UIViewController内存异常,objective-c,uiviewcontroller,Objective C,Uiviewcontroller,点击一个按钮,我将使用以下代码从我的故事板加载到UIViewController InfoViewController *dst = [self.storyboard instantiateViewControllerWithIdentifier:@"InfoViewIdentifier"]; [self.view insertSubview:dst.view atIndex:0]; dst.view.frame = CGRectMake(0, 480, 320, 480); [UIView

点击一个按钮,我将使用以下代码从我的故事板加载到
UIViewController

InfoViewController *dst = [self.storyboard instantiateViewControllerWithIdentifier:@"InfoViewIdentifier"];
[self.view insertSubview:dst.view atIndex:0];
dst.view.frame = CGRectMake(0, 480, 320, 480);

[UIView beginAnimations: @"infoAnimation" context: nil];
[UIView animateWithDuration: 1.0f animations: ^{dst.view.frame = CGRectMake(0, 0, 320, 480);}];
[UIView commitAnimations];
一切都很好。生成的视图上有几个按钮,可以执行简单的操作(关闭视图、在safari中打开URL等),只要我点击其中任何一个按钮,就会收到一个异常。奇怪的是,它可能抛出两个异常中的一个

  • 线程1:EXC_BAD_ACCESS(代码=1,地址=…)-显示应用程序仍在异常断点中运行
  • 缺少标识符UpstreamPlaceholder-2的代理-显示在日志中
我也尝试过使用自定义segues,我也得到了相同的结果

编辑:

经过更多测试后,它似乎随机抛出了错误的访问错误(大多数情况下为80%+)。如果未引发该异常,则safari中打开的链接将正常工作,但用于关闭视图的链接将引发代理标识符错误


如果有任何帮助,我们将不胜感激。

好的,这里是noob的全部问题。该问题与在方法中使用局部变量有关。ARC大部分时间都在扼杀内存中的视图(我的80%引用)。我将
dst
变量移到了头文件中,一切都正常工作。

要添加到前面的答案中: 缺少标识符UpstreamPlaceholder xx的代理也可能在情节提要错误配置中抛出。 就像重复的细胞标识符