OGeek|极客世界-中国程序员成长平台

标题: ios - 使用 token 创建的 Twitter 帐户在 iOS7 上失败 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 16:01
标题: ios - 使用 token 创建的 Twitter 帐户在 iOS7 上失败

我正在开发一个在 iOS6/7 上运行的应用程序,并在 Twitter 上发布自定义 View 。为了改善用户体验,如果没有可用的系统帐户,我会向用户提供一个 web View 以输入他们的凭据,按照 ACAccountCredential.h 中的建议将它们存储在 ACAccountStore 中并使用它来发布。

它在 iOS6 上运行良好,但 在 iOS7 上共享失败并出现 401 错误。奇怪的是该帐户在 ACAccountStore 中没有错误地保存,并且可以被 Twitter 应用程序用来在 Twitter 上阅读和发布(无需进一步登录),所以我假设该帐户( token 和 token secret )工作正常.

SLRequest *postRequest = nil;
NSURL *url = [NSURL URLWithString"http://api.twitter.com/1/statuses/update.json"];
NSDictionary *content = @{@"status":self.textToShare};
postRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter
requestMethod:SLRequestMethodPOST
URL:url
parameters:content];

[postRequest setAccount:self.twitterAccount];
[postRequest performRequestWithHandler:completionHandler];

我也尝试过使用 API v1.1,但它似乎没有帮助。有什么想法吗?



Best Answer-推荐答案


通过将 URL 更改为使用 HTTPS 并使用 API v1.1,它适用于 iOS6 和 iOS7。

关于ios - 使用 token 创建的 Twitter 帐户在 iOS7 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19655777/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4