I am using Obj-c and I can get the actor brad pitt but trying to get his id has been a little more challenging.
Here is the query I am using: https://api.themoviedb.org/3/search/person?query=Brad+Pitt&api_key=xxxxxxxxxxx
This is the JSON object I have of Brad Pitt: { page = 1; results = (
{ adult = 0; id = 287; name = "Brad Pitt"; popularity = "7.84036921219752"; "profilepath" = "/kc3M04QQAuZ9woUvH3Ju5T7ZqG5.jpg"; } ); "totalpages" = 1; "total_results" = 1; }
Then I do:
NSDictionary *results = [json objectForKey:@"results"]; //have also tried NSArray and wouldn't it crashed.
This is what it displays:
{ adult = 0; id = 287; name = "Brad Pitt"; popularity = "7.84036921219752"; "profile_path" = "/kc3M04QQAuZ9woUvH3Ju5T7ZqG5.jpg"; }
My question is how do I extract that id number? Thank you again in advance
Can't find a movie or TV show? Login to create it.
Elementu hau kalifikatu edo zerrenda batera gehitzea nahi al duzu?
Ez zara kidea?
Joey Richardson Erabiltzailearen Erantzuna
Uztaila 29, 2014 egunean 8:45 PM(e)tan
Got it what happens is results is an array containing one object in the [0] index which itself is an NSDictionary so you need to get the first index then call object for key.
marcelosampaio Erabiltzailearen Erantzuna
Uztaila 30, 2014 egunean 5:35 PM(e)tan
Simple Sample: