-1

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.

4

1 回答 1

0

在尝试了更多的事情之后,我找到了一种方法来做到这一点。

做了以下得到我想要的。

- (NSArray *)messages {
    return @[[self.data objectForKey:@"Messages"]];
}
于 2013-09-16T11:59:50.010 回答