I'm new to iPhone Development so bear with me.
I'm trying to access an array stored in the AppDelegate
from another view controller but when I do it tells me the array is empty.
I created an NSMutableAarray
in the AppDelegate
called containerTypeArray.
I build the array with objects in the AppDelegate
method called:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
After I initialize and init with objects the size of my array is 92 confirmed by the following NSLog message:
NSLog(@"container type size %i", [containerTypeArray count]);
I try to reference the array variable in a different view controller. In this view controller I import the appdelegate.h file and write the following in the view did load method:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"count at load %i", [appDelegate.containerTypeArray count]);
This time the NSLog count is 0.
Can some one tell me what I'm doing wrong? Thanks!