mattgemmell / MGTwitterEngine

Objective-C Twitter integration library for Mac OS X and iPhone. Official repository.
http://mattgemmell.com/source
1.14k stars 163 forks source link

Search YAJL Parser can not handle geo locations. #51

Open PeyloW opened 13 years ago

PeyloW commented 13 years ago

The Search YAJL Parser assumes that there is only one, and ever one array in the JSON response. As we all know; asumption is the mother of all disasters.

A tweet with a geo location in it can have an array with locations in the WGS84 coordinate system, like this: "geo" : { "type" : "Point", "coordinates" : [55.592, 13.0087] }

This line will mark the parser as "not inside array", and any data following will be corrupted.

I have solved the problem in my app by letting startArrayWithKey: and endArray always call super, where an arrayDepth is kept. Then I removed insideArray ivar, and instead check for (arrayDepth == 1).

This is also an ugly hack, since subarrays will just be ignored.

btjones commented 13 years ago

This sounds similar to an issue I encountered here: http://github.com/mattgemmell/MGTwitterEngine/issues#issue/31

mojidabckuu commented 12 years ago

My YAJL parser parse geo, but when I did search i had sometging this:

2011-10-30 19:23:28.716 TwitterApp[4719:207]({ "completed_in" = "0.048"; "max_id" = 130690871812296704; "max_id_str" = 130690871812296704; "next_page" = "?page=3&max_id=130690871812296704&q=&geocode=48.036%2C37.7664%2C50mi&rpp=100"; page = 2; "previous_page" = "?page=1&max_id=130690871812296704&q=&geocode=48.036%2C37.7664%2C50mi&rpp=100"; query = ""; "refresh_url" = "?since_id=130690871812296704&q=&geocode=48.036%2C37.7664%2C50mi"; results = { "created_at" = "Sun, 30 Oct 2011 17:01:46 +0000"; "from_user" = AveLOVElovE; "from_user_id" = 289967312; "from_user_id_str" = 289967312; geo = ""; id = 130690871812296704; "id_str" = 130690871812296704; "iso_language_code" = ru; location = "Ukraine, Donetsk"; metadata = { "result_type" = recent; }; "profile_image_url" = "http://a1.twimg.com/profile_images/1495040891/___normal.jpg"; source = "web"; text = "@solpadeine_ U0414U0410?? U0423U0445 U0442U044b U0431U043bU0438U043d! U042f U0431U043eU043bU0435U044e, U043fU043eU0442U043eU043cU0443 U044f U043aU0430U043a U043bU0435U0442U043eU043c U043dU0435 U0441U043eU043eU0431U0440U0430U0436U0430U044e U043aU0430U043aU043eU0439 U0434U0435U043dU044c U0438 U0447U0438U0441U043bU043e :-D"; "touser" = "solpadeine"; "to_user_id" = 266677628; "to_user_id_str" = 266677628; }; "results_per_page" = 100; "since_id" = 0; "since_id_str" = 0; "source_api_request_type" = 33; "to_user_id_str" = { "created_at" = "Sun, 30 Oct 2011 16:42:31 +0000"; "from_user" = katasstrofa; "from_user_id" = 414523235; "from_user_id_str" = 414523235; geo = ""; id = 130686028368445441; "id_str" = 130686028368445441; "iso_language_code" = en; location = Donetks; metadata = { "result_type" = recent; }; "profile_image_url" = "http://a1.twimg.com/profile_images/641810895/IMG_4635_normal.JPG"; source = "foursquare"; text = "I just unlocked the "Explorer" badge on @foursquare! http://t.co/wjdseoxh"; "to_user_id" = ""; "to_user_id_str" = ""; }; })

But must had 100 tweets! Can help me?