Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.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 UIViewAlert导致“传递给实例的选择器无法识别”-已在以前的帖子中检查过_Ios - Fatal编程技术网

Ios UIViewAlert导致“传递给实例的选择器无法识别”-已在以前的帖子中检查过

Ios UIViewAlert导致“传递给实例的选择器无法识别”-已在以前的帖子中检查过,ios,Ios,祝大家2014年幸福美满 在过去的3天里,我一直在努力解决UIViewAlert的一个问题,导致错误“无法识别的选择器传递到实例”,我希望有人能提供线索 我的ViewController层次结构是: AppDelegate通过使用如下代码将VC1设置为其根VC来加载ViewController VC1: [self.window setRootViewController:newNavController]; [window makeKeyAndVisible]; VC1推送DropboxV

祝大家2014年幸福美满

在过去的3天里,我一直在努力解决UIViewAlert的一个问题,导致错误“无法识别的选择器传递到实例”,我希望有人能提供线索

我的ViewController层次结构是:

AppDelegate通过使用如下代码将VC1设置为其根VC来加载ViewController VC1:

[self.window setRootViewController:newNavController];

[window makeKeyAndVisible];
VC1推送DropboxVC视图控制器

DropboxVC尝试引发UIViewAlert,例如,当用户尝试从Dropbox取消链接且已取消链接时,或当同步操作完成时。UIViewAlert以错误结束

[DocsAppDelegate\u viewControllerForSupportedInterfaceOrientations]:发送到实例0x14d24be0的无法识别的选择器

实例0x14d23be0显然是我的AppDelegate实例,我想它还没有被释放

我浏览了以前的线程,并确保UIViewAlert OtherButtonTiles以零终止。我也尝试了这两种方法——直接在DropboxVC中提升UIViewAlert,也在主线程中通过

    [self performSelectorOnMainThread:@selector(showAlertWithTitle:)
                           withObject:@"Application is already linked to Dropbox"
                        waitUntilDone:YES];
警报本身是

- (void)showAlertWithTitle:(NSString *)DispMsg
{
   UIAlertView *alert = [[UIAlertView alloc initWithTitle:@"Error"
                                                    message:DispMsg
                                  delegate:self
                                          cancelButtonTitle:nil
                                          otherButtonTitles:@"OK", nil];
    [alert show];
由于它不起作用,并且我正在将VC1设置为AppDelegate中的RootVC,因此我确保我的AppDelegate和VC1都定义了支持的接口方向、演示文稿的首选接口方向和定义的-voidalertView:UIAlertView*alertView Clicked Button索引:nSintegerButton索引。我已经登录了所有这些方法,但都没有触发。我还设置了断点,但没有触发断点

My.plist声明应用程序支持所有4个方向。我不使用故事板。My Main Window.xib设置为全屏


关于我遗漏了什么,有什么线索吗?

我不确定是否有足够的线索继续,但错误信息很清楚。正在向应用程序委托传递消息-_viewControllerForSupportedInterfaceOrientations,这是视图控制器的专用消息。在某个地方,应用程序委托被分配给某个需要视图控制器的对象。这通常发生在内存泄漏的情况下。确保您正确保留了您应该保留的内容,或者如果您使用的是ARC,您使用的是正确类型的引用,例如strong/weakCan,请发布一些代码,说明您如何初始化控制器以及何时显示警报视图。。。此外,当警报视图刚刚显示或在您按下ok(确定)按钮后会发生崩溃?Thx用于快速响应!在我的AppDelegate中,我是如何启动ViewController VC1的,正如我的postRootViewController*newController=[[RootViewController alloc]init]中提到的那样;[新控制器设置窗口:窗口];newNavController=[[UINavigationController alloc]initWithRootViewController:newController][window addSubview:[newNavController视图]];[self.window setRootViewController:newNavController];[WindowMakeKeyandVisible];我同意AppDelegate被分配了一个VC。我需要做什么才能使UIAlertView正常工作?在我称为VC1的RootViewController中,我确实确保了RootVC是UIViewAlertDelegate,并且我还定义了界面方向以及UIViewAlert ClickedButtonIndex方法。崩溃发生在UIViewAlert显示之前