Quantcast
Channel: The Echo Nest Developer Forum
Viewing all articles
Browse latest Browse all 1582

iOS Trouble Parsing ENAPIRequest Response

$
0
0

An ENAPIRequest returns a NSDictionary as the response (request.response), I'm having a lot of trouble trying to parse it, specifically if I get multiple results for track for songs (example response below), how can I get the values for a specific track since dictionaries are not indexable?

Doing something like [response valueForKeyPath@"response.songs.tracks.foreign_id"] gives me both foreign ids, how can I just get the first one?

{ response = { songs = ( { "artist_foreign_ids" = ( { catalog = spotify; "foreign_id" = "spotify:artist:6vWDO969PvNqNYHIOW5v0m"; } ); "artist_id" = AR65K7A1187FB4DAA4; "artist_name" = "BeyoncU00e9"; id = SOUTJIT142F256C3B5; title = "Partition (Explicit Version)"; tracks = ( { catalog = spotify; "foreign_id" = "spotify:track:2vPTtiR7x7T6Lr17CE2FAE"; //HOW CAN I JUST GET THIS ID? "foreign_release_id" = "spotify:album:1hq4Vrcbua3DDBLhuWFEVQ"; id = TRLHJRD1460052F846; }, { catalog = spotify; "foreign_id" = "spotify:track:6m4ZFQb3zPt3IdRDTN3tfb"; "foreign_release_id" = "spotify:album:5KPpho7rztJrZVA9yXjk8K"; id = TRYMBSK146005C3A46; } ); } ); status = { code = 0; message = Success; version = "4.2"; }; }; }

Also I apologize if the dictionary didn't maintain it's formatting


Viewing all articles
Browse latest Browse all 1582

Trending Articles