Reputation: 1
I am making an iPhone application and need to integrate Twitter in it. I am done with the authentication part, I can post messages but I am not able to retrieve the profile image. Do you have any ideas how this could be accomplished?
Thank you a lot! George
Upvotes: 0
Views: 2798
Reputation: 13137
I haven't used MGTwitterEngine so I can't speak to how to use it to grab a profile image, but it looks like you can get it fairly easily using the Twitter API. Here's how I would grab my own profile image:
Make a call to http://api.twitter.com/1/statuses/user_timeline.json?user_id=3257861
(replace the user_id with whoever's profile image it is you want)
Using a JSON framework (I've been using this), parse the response.
For each tweet in the JSON array, there's a key called profile_image_url
which holds the profile image.
Hope this helps!
EDIT: Actually, there's a MUCH easier way. Just call this URL http://api.twitter.com/1/users/profile_image/3257861.json
, it'll return the profile image. You can read more about it here. I'm leaving the rest up there just for reference (or another way of doing it, albeit not the best way)
Upvotes: 4