0

*Update: This now doesn't work on either the iPhone or the Simulator. After I ran a clean build I got the error on the simulator:

Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/572536B3-5E7D-4F2B-8D80-4345412DCF10/Quotes.app> (loaded)' with name 'RootViewController'

I have inspected the MainWindow.xib file and there is no mention of the RootViewController. I renamed this much earlier to CategoryViewController.

Here is my CategoryViewController at the request of @megger:

#import <UIKit/UIKit.h>
#import "Category.h"
#import "AddSubjectController.h"
#import "SubjectViewController.h"
#import "SBTableAlert.h"

@class SubjectViewController;
@class AddSubjectController;
@class SearchViewController;

@interface CategoryViewController : UITableViewController  <UIAlertViewDelegate, SBTableAlertDelegate, SBTableAlertDataSource> {

    NSMutableArray *categories;
    NSMutableArray *allCategories;
    NSMutableArray *subjects;
    NSMutableArray *allSubjects;
    AddSubjectController *addSubController;
    SubjectViewController *subViewController;
    SearchViewController *svc;
    NSIndexPath* checkedIndexPath;

}

@property (nonatomic, retain) NSMutableArray *categories;
@property (nonatomic, retain) NSMutableArray *allCategories;
@property (nonatomic, retain) Subject *selectedSubject;
@property (nonatomic, retain) Quote *selectedQuote;
@property (nonatomic, retain) NSMutableArray *allSubjects;
@property (nonatomic, retain) NSMutableArray *subjects;
@property (nonatomic,assign) QuoteMapViewController *qmv;
@property (nonatomic,assign) SearchViewController *svc;
@property (nonatomic, assign) NSInteger mySection;
@property (nonatomic, assign) NSInteger myRow;
@property (nonatomic, retain) NSIndexPath* checkedIndexPath;

@end
jroyce
  • 2,029
  • 2
  • 22
  • 45
  • First off, completely delete and reinstall the application, vs installing over a previous version. – Hot Licks Mar 02 '12 at 22:03
  • You mean press and hold, get the "x" and remove? If so, I have done that numerous times. – jroyce Mar 02 '12 at 22:04
  • Also make sure that the version you're testing against on the simulator is the same version as on the phone (close as you can manage). – Hot Licks Mar 02 '12 at 22:05
  • Someone with a similar issue: http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for-the-key – Jeremy Mar 02 '12 at 22:06
  • 1
    is your CategoryViewController set in InterfaceBuilder as type UIViewController instead of CategoryViewController? – meggar Mar 02 '12 at 22:06
  • No it is CategoryViewController in the interface builder. – jroyce Mar 02 '12 at 22:07
  • Wow, I just deleted the app from my simulator and did a clean and then build and now it doesn't work there either! I got the error: Could not load NIB in bundle: 'NSBundle (loaded)' with name 'RootViewController'' – jroyce Mar 02 '12 at 22:10
  • what does CategoryViewController.h look like – meggar Mar 02 '12 at 22:13
  • @meggar... what do you think? – jroyce Mar 02 '12 at 22:35
  • Sort of sounds like your built app isn't actually being installed anywhere/actually built. Did you look in the above path to see what's there? If you remove `~/Library/Developer/DerivedData` what happens? – nielsbot Mar 02 '12 at 22:43
  • Yes this does sound like the problem. @nielsbot, what above path are you referring to? I tried deleting the data in the DerivedData folder and reran it and got the same error, both on the simulator and on the iPhone. – jroyce Mar 02 '12 at 22:50
  • The path as displayed in your comment above--with the missing .xib file. Is the XIB in question still part of your project and target? You can check your Xcode build phases to make sure.. – nielsbot Mar 02 '12 at 23:49
  • The RootViewController.xib is not part of my project anymore and I don't use it. I renamed the RootViewController long ago to CategoryViewController, but it seems some setting was missed that only recently got flushed out. I checked the build phases bundle resources and this does not contain the "RootViewController.xib", rightly so. It does have the CategoryViewController.xib. Where else do I need to look? – jroyce Mar 02 '12 at 23:57
  • In the app delegate do you set window.rootviewcontroller to a CategoryViewController object? – meggar Mar 03 '12 at 00:03
  • Nope. What I have is [window addSubview:[navigationController view]]; Should have specifically set the rootViewController as well? – jroyce Mar 03 '12 at 00:07
  • In your appDelegate.m, in the applicationDidFinishLaunching method. Alloc and init a CategoryViewController from nib file, and set the window.rootviewcontroller to that object – meggar Mar 03 '12 at 00:10
  • 1
    Or set the window.rootviewcontroller to whatever your main view controller is, renaming rootviewcontroller.xib probably not a great idea – meggar Mar 03 '12 at 00:14
  • Could be time to move this to a chat room folks. Thanks. – Kev Mar 03 '12 at 00:20
  • @meggar thanks. I tried that but still got same error message. Let me try refactoring back to RootViewController and see if I get any further on this. – jroyce Mar 03 '12 at 00:29
  • By renaming it back to RootViewController I made some headway and got over that error message. Thank you so much for your help! – jroyce Mar 03 '12 at 00:40

3 Answers3

1

Another stack poster had a similar issue.

Perhaps this will be of assistance: this class is not key value coding-complient for the key.

Community
  • 1
  • 1
Jeremy
  • 8,902
  • 2
  • 36
  • 44
0

I'm not quite sure what you are looking for, are you trying to make it to where you can run certain code in the simulator itself and not on the actual device? If this is what you are looking for, the way I approached this was by defining a macro that allows you to wrap your code inside parentheses and only runs it in the simulator.

#define SIM(x) if ([[[UIDevice currentDevice].model lowercaseString] rangeOfString:@"simulator"].location != NSNotFound){x;}

You can take away the semicolon at the end if you would like to add it within the parentheses, but it might seem weird adding a semicolon between parentheses.

This code is used like this:

SIM(NSLog(@"This is only logged within the simulator."))
Fernando Cervantes
  • 2,962
  • 2
  • 23
  • 34
0
Could not load NIB in bundle: 
'NSBundle </var/mobile/Applications/572536B3-5E7D-4F2B-8D80-4345412DCF10/Quotes.app> 
(loaded)' with name 'RootViewController'

(1) Use a text searcher like BBEdit or EasyFind to search your project folder for "RootViewController". It's there somewhere. For example, if you have a class called RootViewController and you instantiate it with alloc-init or in some other way that fails to specify a nib, it will look for a nib called RootViewController.

(2) What was the last time you did a Clean All on this project? I think it's time to do one. There may be cruft in your built app, and only a Clean can get it out of there. See my advice here: How to Empty Caches and Clean All Targets Xcode 4

Community
  • 1
  • 1
matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Thanks. In the end, I just reverted back to the name RootViewController and the project worked. – jroyce Mar 03 '12 at 02:56
  • Not sure what method you used when you originally renamed the controller, but I strongly suggest using the refactoring tools to do this. – sosborn Mar 03 '12 at 03:07
  • I did use the refactoring tool originally. I changed RootViewController to CategoryViewController, before I knew the headache it would give me later! – jroyce Mar 03 '12 at 03:25
  • But that's not really an acceptable result, is it? You're letting the tools and the framework rule you. It's important to understand how to rename things; you can't let yourself get frozen into a particular name. – matt Mar 03 '12 at 04:51