I'm in need take the data that passes facebook me with the scores of the players, but I can not return the values that are within the braces in xcode.
Example:
{
"data": [
{
"user": {
"id": "927806543903674",
"name": "Renata Gabi"
},
"score": 333,
"application": {
"name": "Player 2",
"namespace": "quemsoueubiblico",
"id": "303489829840143"
}
},
{
"user": {
"id": "964974026864922",
"name": "Player 1"
},
"score": 230,
"application": {
"name": "My Game",
"namespace": "quemsoueubiblico",
"id": "303489829840143"
}
}
]
}
In android I use this
...
jgame = jObject.getJSONArray("data");
...
score = jgame.getString("score");
name = jgame.getJSONObject("user").getString("name");
photo_id = jgame.getJSONObject("user").getString("id");
for ios in xcode, I was trying this, but is not working
myObject = [[NSMutableArray alloc] init];
NSData *jsonSource = [[NSData alloc] initWithContentsOfURL:
[NSURL URLWithString:@"http://ift.tt/1DojM8O"]];
id jsonObjects = [NSJSONSerialization JSONObjectWithData:
jsonSource options:NSJSONReadingMutableContainers error:nil];
for (NSDictionary *dataDict in jsonObjects) {
NSString *score_data = [dataDict objectForKey:@"score"];
NSString *name_data = [dataDict objectForKey:@"name"];
NSString *id_data = [dataDict objectForKey:@"id"];
NSLog(@.........);
dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
score_data, score,
name_data, name,
id_data, id,
nil];
[myObject addObject:dictionary];
}
I am not able to adjust the "data" facebook graph, and get the subclasses
Aucun commentaire:
Enregistrer un commentaire