我写了以下代码:
但我总是遇到“Bad authentication”错误。感觉我漏了什么。请问有人可以检查我的代码吗?或者提供任何建议来获取Twitter用户的个人资料图片?谢谢。
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);
}
}];
但我总是遇到“Bad authentication”错误。感觉我漏了什么。请问有人可以检查我的代码吗?或者提供任何建议来获取Twitter用户的个人资料图片?谢谢。