{
NSString *postUrl = @"http://api.twitter.com/1/users/profile_image.json ";
ASIFormDataRequest *request = [[ASIFormDataRequest alloc]
initWithURL:[NSURL URLWithString:postUrl]];
[request addRequestHeader:@"Authorization"
value:[oAuth oAuthHeaderForMethod:@"GET"
andUrl:postUrl
andParams:nil]];
[request setPostValue: userName forKey:@"screen_name"];
[request startSynchronous];
}
In my application I want to show the twitter profile image of the user who uses this application which is for uploading images to twitter. How can I retrieve the profile image of the user? I am using the url http://api.twitter.com/1/users/profile_image/:screen_name.format for this. And ASIHTTP GET method.But it fails. Can anyone help me to do this? The code i am using is given above.
You are using the wrong URL, just replace the :screen_name.format to the the users screen name and image format:
NSString *imageUrl = @"http://api.twitter.com/1/users/profile_image/rckoenes.png";
ASIHTTPRequest *request = [[ASIHTTPRequest alloc]
initWithURL:[NSURL URLWithString:imageUrl]];
[request startSynchronous];