将twitter api与本机IOS连接
我正在尝试将推文嵌入到tableView中,这似乎可以通过使用fabric来实现。然而,在遵循了确切的分步指南之后,我不断收到将twitter api与本机IOS连接,ios,swift,twitter,twitter-fabric,Ios,Swift,Twitter,Twitter Fabric,我正在尝试将推文嵌入到tableView中,这似乎可以通过使用fabric来实现。然而,在遵循了确切的分步指南之后,我不断收到错误的请求:400。到目前为止,我已经添加了确切的。为什么我仍然得到这个错误 以下是我所做的: 添加了库和框架TwitterKitResources.bundle,TwitterKit.Framework和TwitterCore.Framework 添加了/Fabric.framework/run运行脚本 将此添加到appDelegate Twitter.sharedIn
错误的请求:400
。到目前为止,我已经添加了确切的。为什么我仍然得到这个错误
以下是我所做的:
TwitterKitResources.bundle
,TwitterKit.Framework
和TwitterCore.Framework
/Fabric.framework/run
运行脚本Twitter.sharedInstance().startWithConsumerKey(“消费者密钥”,ConsumerCret:“消费者秘密”)
Fabric.with([Twitter.sharedInstance()])
TableViewController
中
import UIKit
import TwitterKit
class TweetsViewController: UITableViewController, TWTRTweetViewDelegate {
let tweetTableReuseIdentifier = "TweetCell"
// Hold all the loaded Tweets
var tweets: [TWTRTweet] = [] {
didSet {
tableView.reloadData()
}
}
let tweetIDs = ["603232039354114048"]
override func viewDidLoad() {
// Setup the table view
self.title = "Tweets"
self.view.backgroundColor = UIColor(rgba: "#f9f9f9")
self.navigationController?.navigationBar.barTintColor = UIColor(rgba: "#B52519")
self.view.backgroundColor = UIColor(rgba: "#f9f9f9")
tableView.estimatedRowHeight = 150
tableView.rowHeight = UITableViewAutomaticDimension // Explicitly set on iOS 8 if using automatic row height calculation
tableView.allowsSelection = false
tableView.registerClass(TWTRTweetTableViewCell.self, forCellReuseIdentifier: tweetTableReuseIdentifier)
// Load Tweets
Twitter.sharedInstance().APIClient.loadTweetsWithIDs(tweetIDs) { tweets, error in
if let ts = tweets as? [TWTRTweet] {
self.tweets = ts
} else {
println("Failed to load tweets: \(error.localizedDescription)")
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.tweets.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let tweet = tweets[indexPath.row]
let cell = tableView.dequeueReusableCellWithIdentifier(tweetTableReuseIdentifier, forIndexPath: indexPath) as! TWTRTweetTableViewCell
cell.configureWithTweet(tweet)
cell.tweetView.delegate = self
return cell
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
let tweet = tweets[indexPath.row]
return TWTRTweetTableViewCell.heightForTweet(tweet, width: CGRectGetWidth(self.view.bounds))
}
}