问题描述
我正在使用Fabric的推特工具包,通过向REST API端点" https://api.twitter.com/1.1/statuses/user_timeline.json "
I am using Fabric's twitter kit for getting a username's tweets in my iOS application by making a request to the REST API endpoint "https://api.twitter.com/1.1/statuses/user_timeline.json"
我已经按照我的AppDelegate和info.plist中的Fabric应用程序提供的方式正确设置了消费者密钥"和消费者秘密密钥",但是我反复收到以下错误消息-
I am have correctly set up my "consumer key" and "consumer secret key" as provided by the Fabric app in my AppDelegate and info.plist , but I repeatedly get the following error message -
我的代码如下-
Twitter.sharedInstance().startWithConsumerKey(TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_KEY_SECRET)
Fabric.with([Twitter.sharedInstance()])
let userId = Twitter.sharedInstance().sessionStore.session()?.userID
let client = TWTRAPIClient.init(userID: userId)
let params = ["screen_name": twitterUsername, "count" : "10"]
var clientError : NSError?
let request = client.URLRequestWithMethod("GET", URL: TWITTER_TIMELINE_ENDPOINT, parameters: params, error: &clientError)
client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in
if(connectionError == nil) {
self.twitterJson = self.nsdataToJSON(data!)!
self.constructTweetView(self.twitterJson)
}
else {
print("Error: \(connectionError)")
}
我使用的是TwitterKit(> 2.0)的最新版本
I am on the most recent version of TwitterKit(>2.0)
我该如何解决呢?
谢谢!
推荐答案
在例外域中添加密钥,如info.plist中所示.正在为我修复错误.
Add key in exception domains as shown in info.plist. Following fixed bug for me.
这篇关于将访客身份验证与TwitterKit iOS结合使用以获取用户时间轴时出现错误代码403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!