Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.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
Iphone Nib加载失败_Iphone_Ios_Objective C_Xcode4 - Fatal编程技术网

Iphone Nib加载失败

Iphone Nib加载失败,iphone,ios,objective-c,xcode4,Iphone,Ios,Objective C,Xcode4,在我的应用程序中,我制作了自定义选项卡栏,其中有5个选项卡,每个选项卡显示不同的UIViewController 该应用程序仅适用于iPhone,因此我为每个UIViewController(如果类名为DayView,则NIB为DayView\u iPhone和DayView\u iPhone 5)制作了2个NIB。无论是在设备中还是在模拟器中,都可以正常工作10分钟 应用程序崩溃后,在控制台中显示: Terminating app due to uncaught exception 'NSIn

在我的应用程序中,我制作了自定义选项卡栏,其中有5个选项卡,每个选项卡显示不同的
UIViewController

该应用程序仅适用于iPhone,因此我为每个
UIViewController
(如果类名为DayView,则NIB为DayView\u iPhone和DayView\u iPhone 5)制作了2个NIB。无论是在设备中还是在模拟器中,都可以正常工作10分钟

应用程序崩溃后,在控制台中显示:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/kalyanasadinagarajugari/Library/Application Support/iPhone Simulator/6.1/Applications/0DEBB118-BA67-440F-BA70-79ED41AC9134/CalendarBlender.app> (loaded)' with name 'DayView_iPhone''
尝试检查Nibname(区分大小写)并清理项目,然后重新运行它。您是否更改了所有NIB的类名?

使用此选项:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
   tabBarController = [[UITabBarController alloc] init];

   MyViewController* vc1 = [[MyViewController alloc] initWithNibName:@"nibName" bundle:nil];
   MyOtherViewController* vc2 = [[MyOtherViewController alloc] initWithNibName:@"nibName" bundle:nil];

   NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
   tabBarController.viewControllers = controllers;

    window.rootViewController = tabBarController;
}

您也可以通过在tabBarController的ViewController数组中添加控制器来动态添加控制器。

检查:-每个Nibname都是完美的,我检查了所有的Nibname。我的问题将在不断更改选项卡后出现。NSString*nibName=[AppDelegate fetchNibWithViewControllerName:@“DayView”];dayView=[[dayView alloc]initWithNibName:nibName bundle:nil];如果(IS_IPHONE_5)dayView.view.frame=CGRectMake(0,44320463);else dayView.view.frame=CGRectMake(0,44320375);dayView.view.tag=2;[self.view addSubview:dayView.view];这就是我打电话的方式,代码有错吗,名字是DayView\u iPhone,DayView\u iPhone 5在你的问题中添加你的代码。。这样我们才能清楚地理解它。你在哪里写的这段代码?i、 e在DidfinishLaunchingwithoptions中或在何处?
- (void)applicationDidFinishLaunching:(UIApplication *)application {
   tabBarController = [[UITabBarController alloc] init];

   MyViewController* vc1 = [[MyViewController alloc] initWithNibName:@"nibName" bundle:nil];
   MyOtherViewController* vc2 = [[MyOtherViewController alloc] initWithNibName:@"nibName" bundle:nil];

   NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
   tabBarController.viewControllers = controllers;

    window.rootViewController = tabBarController;
}