NSInternalInconsistencyException Could not load nib in bundle

前端 未结 7 752
遥遥无期
遥遥无期 2020-11-28 14:12

I\'ve created an application for child game.

It loads 12 different questions for each round. After the 4th round the app crashes with the following log:



        
相关标签:
7条回答
  • 2020-11-28 14:48

    Another common issue is trying to load a nib in the init methods of viewControllers. Should be in viewDidLoad.

    0 讨论(0)
  • 2020-11-28 14:51

    set your button click image like this :

    NSString *path1 = [[NSBundle mainBundle] pathForResource:@"btn_twelve_month" ofType:@"png"];
    [btn_twelve_month setImage:[UIImage imageWithContentsOfFile:path1] forState:UIControlStateNormal];
    

    instead of this :

    [btn_twelve_month setImage:[UIImage imageNamed:@"btn_twelve_month.png"] forState:UIControlStateNormal];
    

    It works..

    0 讨论(0)
  • 2020-11-28 14:53

    There is a chance that Base Internationalization will cause a crash with the same error message, because the feature is only supported in iOS 5 and above!

    However, since you can start the app and it crash only after a while, it should not be due to Base Internationalization.

    0 讨论(0)
  • 2020-11-28 14:56

    You may renamed your ViewController That should be updated in AppDelegate file so navigate to AppDelegate.m and do the following.

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.viewController = [[XXXXViewController alloc] initWithNibName:@"XXXXXViewController" bundle:nil];

    In that XXXX rename your latest ViewController name(i.e renamed ViewControllerName).Now It will work .

    0 讨论(0)
  • 2020-11-28 14:57

    It looks like you're trying to instantiate a nib called ThemePickerController.nib and it isn't present. Is the nib included as a project member?

    0 讨论(0)
  • 2020-11-28 15:03

    It is easy... select the XIB file and make sure the desired target of the project is checked under the "Target Membership" section (under the "Show the file inspector" tab), and your problem is solved.

    It is usually happening when you made a copy of an exists file and added to the project manually because in that case you should check the above mentioned target manually as well.

    0 讨论(0)
提交回复
热议问题