I've been having a devil of a time trying to get my JSON parsed IN ORDER in IOS5. It is coming in order from the server, so I know it's not that. Here is my code:
NSArray *userData = [update JSONValue];
NSLog(@"USERDATA%@", userData);
NSEnumerator *enumerator = [userData objectEnumerator];
id key;
while (key = [enumerator nextObject]) {
NSDictionary *value = key;
NSString *comment = [value objectForKey:@"comment"];
NSLog(@"USERCOMMENT %@", comment);
}
The first NSLog, everything is looking beautiful. The second NSLog is giving me everything out of order. I'm pretty much at my wit's end.
First NSLOG:
USERDATA{
1 = {
comment = "Test 6";
photoID = 1;
postedDate = "2 days ago";
userID = 17;
userPic = "members/0/image01.png";
username = kismet;
};
2 = {
comment = "Test 5";
photoID = 1;
postedDate = "2 days ago";
userID = 17;
userPic = "members/0/image01.png";
username = kismet;
};
3 = {
comment = "Test 4";
photoID = 1;
postedDate = "2 days ago";
userID = 17;
userPic = "members/0/image01.png";
username = kismet;
};
4 = {
comment = "Test 3";
photoID = 1;
postedDate = "2 days ago";
userID = 17;
userPic = "members/0/image01.png";
username = kismet;
};
5 = {
comment = "Test 2";
photoID = 1;
postedDate = "2 days ago";
userID = 17;
userPic = "members/0/image01.png";
username = kismet;
};
6 = {
comment = "Test 1";
photoID = 1;
postedDate = "2 days ago";
userID = 17;
userPic = "members/0/image01.png";
username = kismet;
};
}
Second NSLog:
USERCOMMENT Test 4
USERCOMMENT Test 6
USERCOMMENT Test 1
USERCOMMENT Test 3
USERCOMMENT Test 5
USERCOMMENT Test 2