Reputation: 1136
Hello I'm hoping to work through this tutorial to learn how to recreate one of my most favorite apps: Clear App by RealMac software.
But I am literally stuck at the beginning. After the first section, before even styling the rows, the tableView is not being populated by the NSMutableArray made in the initWithNibName.
All my code is EXACTLY the same but when I run it I am getting this error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/DD956F2E-26A7-4357-BCD7-DC0C42939861/Clear App Tutorial.app> (loaded)' with name 'UIViewController''
Is there anything that could be missing from the code that is a difference of versions from when the tutorial was made and with Xcode 5 now?
Like do I need to "release" or "addToSubView" the _toDoListItems array in the viewDidLoad method?
Sorry, I am very new to Objective-C and so far it is a big headache for me. :-/
This is in my AppDelegate.m:
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
....etc. and @end
And this is in my AppDelegate.h:
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : UIResponder
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end
Upvotes: 0
Views: 139
Reputation: 1286
Ok this is very common issue with UIs check whether you have created two outlets for same UIElement(button,tableview etc)... delete that by right clicking on UIElement.... For eg,
Make sure there is only one referencing outlet for everyView if there is more than one delete the extra one
Upvotes: 1
Reputation: 525
It is difficult to tell exact reason, but I can see your app delegate is inheriting from UIResponder, which does not require anything to be done to show UIWindow (no initWithNibName, no call to makeKeyAndVisible).
You need to ensure that: 1. didFinishLaunchingWithOptions: method just needs to return YES. 2. On the storyboard, for the ViewController is "is initial view controller" is checked in the attributes inspector (So that it becomes first screen shown after launch of app).
That may fix the problem. Let me know whether it works.
Other possible reason could be (as exception name suggests) any inconsistency in the references to the files, try removing all files and adding them again.
Upvotes: 1
Reputation: 1395
Without seeing any code I am going to assume you are doing this in the appDelegate:
[[SHCViewController alloc] initWithNibName:@"UIViewController" bundle:nil];
Where as you should be doing this:
[[SHCViewController alloc] initWithNibName:@"SHCViewController" bundle:nil];
Upvotes: 1