当我试图得到https://api.twitter.com/1.1/statuses/retweets/21947795900469248.json https://api.twitter.com/1.1/statuses/retweets/21947795900469248.json与我的授权凭证(oauth)
, 我越来越:
{
"errors": [
{
"message": "Your credentials do not allow access to this resource",
"code": 220
}
]
}
error:任何其他 twit id 都不起作用。这个端点有问题吗?因为直到昨天我才得到真实的回应。有什么改变吗?
我遇到了同样的问题,收到错误代码 220。我的解决方法是提示用户再次输入 Twitter 密码。
检查下面的示例代码:
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter
requestMethod:SLRequestMethodPOST
URL:[NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/update.json"]
parameters:@{@"status": tweetString}];
[request setAccount:account];
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if ([responseData isKindOfClass:[NSData class]]) {
NSError *jsonError = nil;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonError];
if (json) {
NSArray *errors = json[@"errors"];
if (errors.count) {
NSUInteger errorCode = [json[@"errors"][0][@"code"] integerValue];
if (errorCode == 220) {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
[accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error2) {
NSLog(@"Renew result: %ld, error: %@", (long)renewResult, error2);
if (renewResult == ACAccountCredentialRenewResultRenewed) {
[self __makeTweetWithAccounts:@[account] rating:rating review:review];
}
}];
}
}
}
}
NSLog(@"Twitter response data: %@", [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
}];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)