【发布时间】:2016-12-15 14:02:09
【问题描述】:
我正在使用以下代码尝试将简单的状态更新发布到 Twitter。每次,我都会收到 403 禁止错误。我已经尝试过使用多个帐户和几个不同的状态消息。我错过了什么?
ACAccount *account = [_accountsArray objectAtIndex:1];
ACAccountStore *account_store = [[ACAccountStore alloc] init];
ACAccountType *account_type_twitter = [account_store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
account.accountType = account_type_twitter;
NSURL *requestURL = [NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/update.json"];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:requestURL parameters:dataDict];
request.account = account;
[request performRequestWithHandler:^(NSData *data, NSHTTPURLResponse *response, NSError *error) {
NSLog(@"%@", response);
}];
【问题讨论】:
-
嗯,终于用另一部手机试了一下,那次发帖很好。不知道为什么它会在那里工作,而不是第一部手机 - 我授权该应用使用 Twitter,这是我第一次尝试发布内容,所以 API 不会限制我的速度。