Domanda

Had a UIViewController subclass with a XIB that has a table view, which I decided to turn into a UITableViewController subclass without XIB.

So in the .header I changed:

@interface AViewController : UIViewController <UITableViewDataSource, UITableViewDelegate,
                                               UISearchBarDelegate, UISearchDisplayDelegate>

@property (nonatomic, weak) IBOutlet UITableView* tableView;

to:

@interface AViewController : UITableViewController <UISearchDisplayDelegate, UISearchBarDelegate>

And in the .module file changed a line in my init from:

if (self = [super initWithNibName:@"AView" bundle:nil])

to:

if (self = [super initWithStyle:UITableViewStylePlain])

That should be all you'd expect. But when I run the app it crashes. The init is called and return, but soon after that a crash. viewDidLoad etc. are not called.

Things I've tried many things: Remove the XIB, Clean Build Folder..., removed app from device, restarted Xcode, restarted Mac, but nothing worked.

What did work was renaming AViewController to AViewController_ in this module and then where it was used in my app.

My guess is that there's some memory of XIB and that the XIB is still being instantiated; but it's a weird guess.

Any idea what this could be and how to fix it?

È stato utile?

Soluzione

I updated all my other XIBs to Xcode 5 and the problem disappeared.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top