View Full Version : Accessing array from another class

Jul 23, 2008, 04:31 PM
I have an array in my NameAppDelegate class that I would like to access from somewhere else. What is the correct syntax to access it? I currently have the following in my viewController class and the arrayName array is set up properly in the NameAppDelegate class.

NameAppDelegate *appDelegate = (NameAppDelegate *)[[UIApplication sharedApplication] delegate];

NSLog([appDelegate.arrayName objectAtIndex:0]);

Checking the console I don't see any value printed yet I can test a different array from the same file and it prints correctly.

Jul 23, 2008, 04:42 PM
Never mind, I figured out the problem. My database wasn't initialized before control was passed to the line.