Question

First i'm new to xcode and objective c. I'm trying to fill 6 array's with data out of an NSDictionary that's filled with JSON data.

I'm trying [self.messages setValuesForKeysWithDictionary:[self.data objectForKey:@"Messages"]] but this creates an error exc_bad_access code=2

Where self.messages is an NSArray and self.data is a NSDictionary with data.

So how do you do this?

NSLog(@"Messages array %@", [self.data objectForKey:@"Messages"]);

my NSLog shows the correct data thats in the NSDictionary so the JSON is not the problem.

Was it helpful?

Solution

After trying more things i found a way to do this.

Did the following to get what i want.

- (NSArray *)messages {
    return @[[self.data objectForKey:@"Messages"]];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top