i have a simple question : why does “origineArray” return (null) ? i found out that if i put all the code in the RootViewController it works, but if i put it in the AppDelegate (as it is in a sample code, i don’t which way is better?) , it does not recognize the “Root” key :
- (id)init {
self = [super init];
if (self){
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"origine.plist"];
origine = [[NSDictionary dictionaryWithContentsOfFile:finalPath]retain];
}
return self;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog(@"origine data : %@", origine);
NSArray *origineArray = [origine objectForKey:@"Root"];
NSLog(@"origineArray data : %@", origineArray);
Thanks for your help
If your application delegate is created in a nib file, the
initmethod is not called. Items in nibs are archived already initialized.If you want initialization of an object loaded from a NIB, implement the
- (void) awakeFromNibmethod.