Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.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 NSArray中存储的UINavigationController的childviewcontroller在ipad上崩溃_Objective C_Ios4_Uinavigationcontroller_Nsarray_Hashtable - Fatal编程技术网

Objective c NSArray中存储的UINavigationController的childviewcontroller在ipad上崩溃

Objective c NSArray中存储的UINavigationController的childviewcontroller在ipad上崩溃,objective-c,ios4,uinavigationcontroller,nsarray,hashtable,Objective C,Ios4,Uinavigationcontroller,Nsarray,Hashtable,我有代码获取导航控制器的特定childviewcontroller NSArray *contllrs = [self.navigationController childViewControllers]; NSLog(@"controllers : %@",contllrs); if([contllrs count]>3) [self.navigationController popToViewController:[contllrs objectAtIndex:

我有代码获取导航控制器的特定childviewcontroller

NSArray *contllrs = [self.navigationController childViewControllers];
NSLog(@"controllers : %@",contllrs);
 if([contllrs count]>3)
           [self.navigationController popToViewController:[contllrs objectAtIndex:0] animated:YES];
它将日志作为

childviewcontrollers : NSHashTable (%@) {
[3] <abcVC: 0x1dc1d0>
[4] <defVC: 0x5daf790>
[7] <efgVC: 0x1724a0>
[10] <adsfVC: 0x1b14f0>
[11] <SdfVC: 0x1e2c30>
}

这在iPad模拟器上运行正常,但在iPad上崩溃

请尝试使用以下代码:

    NSArray * viewController = self.navigationController.viewControllers;
    if([viewController count] > 3)
    {
        UIViewController * vc = [viewController objectAtIndex:0];
        [self.navigationController popToViewController:vc animated:YES];
    }

请尝试使用以下代码:

    NSArray * viewController = self.navigationController.viewControllers;
    if([viewController count] > 3)
    {
        UIViewController * vc = [viewController objectAtIndex:0];
        [self.navigationController popToViewController:vc animated:YES];
    }

不确定是否输入错误,但您缺少if语句的右括号。就我所知,它甚至不应该编译。它只是IF-so中的一行,我没有放括号。我不确定它是否输入错误,但您缺少IF语句中的右括号。据我所知,它甚至不应该编译。如果是的话,它只是一行,我没有加括号