我在我的应用程序中使用 MSTwitterEngine,将 twitter api 更新到 v1.1,我无法获取用户信息、关注者列表和发送直接消息。
我试图调用新的 api url,但得到错误的身份验证作为响应。
请看下面的片段:-
参考:- https://dev.twitter.com/docs/api/1.1/get/followers/list
NSString *strUrl = [NSString stringWithFormat:@"https://api.twitter.com/1.1/followers/list.json?cursor=-1&screen_name=%@",strUserName];
NSURL *url=[NSURL URLWithString:[strUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *mRequest = [NSMutableURLRequest requestWithURL:url];
[mRequest setValue:@"application/json" forHTTPHeaderField:@"content-type"];
[mRequest setHTTPMethod:@"POST"];
NSURLResponse *response = nil;
NSError *error = nil;
NSData *responseData1 = [NSURLConnection sendSynchronousRequest:mRequest returningResponse:&response error:&error];
if (error!=nil) {
}
NSString *responseString = [[NSString alloc]initWithData:responseData1 encoding:NSUTF8StringEncoding];
SBJSON *json=[SBJSON new];
NSDictionary *responseDic=[json objectWithString:responseString error:&error];
响应:- {"errors":[{"message":"Bad Authentication data","code":215}]}