nested NSDictionary's and objectForKey

Discussion in 'Mac Programming' started by BollywooD, Sep 19, 2009.

  1. BollywooD macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #1
    I am wanting to create an NSArray from strings stored (at various levels) in a plist of nested NSDictionary's.

    I am trying the following code, but it only reads the key from the root dictionary: (FolderPath, and PlistFullName, have been previously defined)

    Code:
    NSString *plistFolder = [FolderPath stringByExpandingTildeInPath];
    	NSString *PlistPath = [plistFolder stringByAppendingPathComponent:PlistFullName];
    	
    	NSDictionary *myDictionary = [NSDictionary dictionaryWithContentsOfFile: PlistPath];
    	NSArray *myArray = [myDictionary objectForKey:@"myKey"];
    where do I begin?
     
  2. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    First step: Forget for a second that you want an NSArray containing objects in a dictionary, just think about creating an NSArray containing various objects. How do you do that?

    Next step: How do you get various objects from an NSDictionary, stored in different places?

    Third step: Put one and two together.
     

Share This Page