Accessing array from another class

Discussion in 'iOS Programming' started by Xentarios, Jul 23, 2008.

  1. Xentarios macrumors newbie

    Jul 23, 2008
    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.
  2. Xentarios thread starter macrumors newbie

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

Share This Page