Skip to main content

Read plist from URL into NSMutableDictionary



I am trying to do read a PLIST from URL to a NSMutableDictionary.





Code before







autos = [[NSMutableArray alloc] init];



[autos addObject:[[NSMutableDictionary alloc]initWithObjectsAndKeys:@"Auto 1", @"name", @"Auto.png", @"image", @"Klassiker", @"description" , nil]];







This works. But now I want to use a PLIST. And I am trying this, this way:







autos = [[NSMutableArray alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://dl.dropbox.com/u/9358444/auto.plist"]]];







Thanks.





PLIST http://dl.dropbox.com/u/9358444/auto.plist


Comments

  1. Your property list contains a dictionary, but you're trying to use it to instantiate an array. Do this instead:

    NSMutableDictionary *autos = [[NSMutableDictionary alloc] initWithContentsOfURL:
    [NSURL urlWithString:@"http://dl.dropbox.com/u/9358444/auto.plist"]];

    ReplyDelete
  2. I'm new to the site, I'm still not sure how to add comments to the OP. Load it into a dictionary first then transfer it into a mutable array

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?