I downloaded MGTwitterEngine and added to my iPhone project. It's connecting and getting statues I can tell from dumping them into an NSLog. But, I can't figure out how how I need to parse the calls so I can add them to a table. They are returned as an NSString and look like this:
{
"created_at" = 2009-07-25 15:28:41 -0500;
favorited = 0;
id = 65;
source = "<a href=\"http://twitter.com/\">Twitter</a>";
"source_api_request_type" = 0;
text = "The wolf shirt strikes again!! #sdcc :P http://twitpic.com/blz4b";
truncated = 0;
user = {
"created_at" = "Sat Jul 25 20:34:33 +0000 2009";
description = "Host of Tekzilla on Revision3 and Qore on PSN. Also, a geek.";
"favourites_count" = 0;
"followers_count" = 0;
following = false;
"friends_count" = 0;
id = 5;
location = "San Francisco";
name = "Veronica Belmont";
notifications = false;
"profile_background_tile" = false;
"profile_image_url" = "http://blabnow.com/avatar/Twitter_10350_new_twitter_normal.jpg";
protected = 0;
"screen_name" = Veronica;
"statuses_count" = 2;
"time_zone" = UTC;
url = "http://www.veronicabelmont.com";
"utc_offset" = 0;
};
Anybody used this that can tell me how everyone else uses it in their project?
Thanks
For anyone else who might find their way here, here's one way to parce the results. (From a newbie, so don't count of this being the standard or even correct way)
The key (pun intended :D) is to use the dictionary in the appropriate delegate method. Check out Matt Long's example code in another thread on the topic.
To parce something like this:
His example is this, in the delegate method:
This would give you a very simple message that goes "User username(userid): message".
I'm not sure what the best way to proceed would be, I'm thinking returning a dictionary or an array that you could use elsewhere in your implementation. Or just return the original array and parse it elsewhere.
Check out that other thread for more info.
What you are seeing in your console is an NSLog of an NSDictionary and not an NSString. From Matt Gemmell's MGTwitterEngine Readme:
So whatever object you passed to your NSLog() statement is actually a dictionary and you can access the fields with a call to:
Where record is the object. Keep in mind that the user field is a sub-dictionary. You access it this way:
You could actually use the NSArray returned in the request as your table view's data source and then just extract the one you need by the index in your -cellForRowAtIndexPath table view delegate.
Best Regards,