¿Cómo obtener la imagen de perfil de twitter en ios?
Escribí el siguiente código:
NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1.1/users/show.json"];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:username, @"screen_name" ,[[controller.engine accessToken] secret]];
TWRequest *request = [[TWRequest alloc] initWithURL:url parameters:params requestMethod:TWRequestMethodGET];
[request performRequestWithHandler:
^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (responseData) {
NSDictionary *user = [NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingAllowFragments
error:NULL];
NSString *profileImageUrl = [user objectForKey:@"profile_image_url"];
NSLog(@"%@",profileImageUrl);
}
}];
Pero siempre termino recibiendo unaBad authentication
error. Siento que me estoy perdiendo algo. ¿Alguien por favor verifica mi código? O proporcionar alguna sugerencia para recuperar fotos de perfil de usuario de Twitter?
Gracias