My application works for iOS 5.1 but for iOS 6 simulator I get the following error.
Terminating app due to uncaught exception \'NSInternalInconsist
In short, you are setting a custom UITableViewController subclass to a UIViewController !! You cannot do this. You should give the UIViewController a UIViewController subclass.
This worked for me. Hope it helps you.
In AppDelegate-->
#import "TableViewController.h" // name of your TableViewController class
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//PUT
TableViewController *controller = [[TableViewController alloc]
initWithStyle:UITableViewStylePlain];
self.window = [[UIWindow alloc]
initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = controller;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
// Override point for customization after application launch.
return YES;
}
Make sure in storyboard your view controller points to this class:
The reason might be :
.h file check that it is a subclass of UIViewController. it will solve the problem.
I find the solution when using Storyboards and 1 table View.
The key is when you create a custom class (newViewController) just check that is a subclass of UITableViewController. Once created Go to the table view controller (of our table) and in the Identity Inspector select the custom class that just created before (newViewController).
That works for me. Hope my comment help someone.
I also encountered this problem, but I used storyboard in xcode 6.2. I deleted the corresponding view from storyboard and re-dragged the table view controller from the object library to storyboard, then it works.
If you use UITableView as your Top View.
Like this :
You need use UITableViewController in your Controller
class ItemsViewController: UITableViewController
If you use UITableView under a View in your Storyboatd.
Like this :
You need use UITableViewDelegate and UITableViewDataSource with UIViewController
class ItemsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource