0

I was debugging an iOS app.

When I run

        ProductListViewController *pListController = [[ProductListViewController alloc] initWithStyle:UITableViewStylePlain];
        pListController.title = @"我的收藏";
        //pListController.product=self.product;
        pListController.opeType = Get_MyCollect;
        [self.navigationController pushViewController:pListController animated:YES];

My app quit without print anything in my Xcode output?

Any idea?

I open all option in Edit Scheme

And no more info print also.

enter image description here

jeswang
  • 1,017
  • 14
  • 26

2 Answers2

0

Create an exception breakpoint to pause on all exceptions when they are thrown. This will at least give you a sense of where the problem is.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Thank you for the tip! It did stopped, but the Xcode shows only some assemble code. – jeswang Apr 02 '13 at 02:33
  • Put a normal breakpoint at the start of your method and when you pause there, step one line at a time to figure out which line is causing the crash. – matt Apr 02 '13 at 02:37
  • just called pushViewController, and the app crashed. Watch the screenshot. – jeswang Apr 02 '13 at 02:50
  • Find the reason by : (lldb) po $eax $8 = 777388000 -[UITableViewController loadView] loaded the "ProductListViewController" nib but didn't get a UITableView. – jeswang Apr 02 '13 at 03:01
  • Odd, As a UITableViewController, I should add a UITableView in nib file by my self? – jeswang Apr 02 '13 at 03:03
  • Thank you a lot! I was stupid. I should search more. http://stackoverflow.com/questions/11221802/nib-but-didnt-get-a-uitableview – jeswang Apr 02 '13 at 03:07
0

You have a custom UITableViewController called ProductListViewController, and you instantiate it like this:

[[ProductListViewController alloc] initWithStyle:UITableViewStylePlain];

The problem is that you also have a ProductListViewController nib. In iOS 6 (not iOS 5 and before) this nib is loaded automatically as your ProductListViewController view controller's nib when you say the above line of code. Therefore ProductListViewController must be the nib's owner and both its view and its tableView must be a UITableView in the nib.

Alternatively, simply change the nib's name, or delete the nib (and rebuild the project folder)! Now your UITableViewController will create its own UITableView.

matt
  • 515,959
  • 87
  • 875
  • 1,141