Oliver
Oliver

Reputation: 23550

iPhone : Simple UITableViewController crash without console error nor debugging clue

I'm trying to build a simple TableView program struture. It seems to work fine, but if I scroll the list to high or to low, the app crashes without any console error and the trace into the debugger does not help.

You can see it by yourself looking at the project I put at : http://shine.free.fr/tmp/myTestApp.zip

Can you help me :

Thank you for your help

Upvotes: 0

Views: 255

Answers (1)

Vladimir
Vladimir

Reputation: 170859

The problem is that your ListController object is not retained when it is loaded from nib file, so it is not guaranteed that it will be valid after nib is loaded (and in fact it is not). To solve your problem add an outlet for ListController property and define retaining property for it. Here's FenetreListeController.h that fixes your problem:

#import <UIKit/UIKit.h>

@class ListeController;

@interface FenetreListeController : UIViewController {
    IBOutlet ListeController* listController;
}

@property (nonatomic, retain) ListeController* listController;
@end

You will also need to set outlet connection in IB and synthesize property in .m file

For more information about how objects are loaded from xib files check "The Nib Object Life Cycle" section from "Resource Programming Guide"

Upvotes: 1

Related Questions