Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将twitter api与本机IOS连接_Ios_Swift_Twitter_Twitter Fabric - Fatal编程技术网

将twitter api与本机IOS连接

将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

我正在尝试将推文嵌入到tableView中,这似乎可以通过使用fabric来实现。然而,在遵循了确切的分步指南之后,我不断收到
错误的请求:400
。到目前为止,我已经添加了确切的。为什么我仍然得到这个错误

以下是我所做的:

  • 添加了库和框架
    TwitterKitResources.bundle
    TwitterKit.Framework
    TwitterCore.Framework
  • 添加了
    /Fabric.framework/run
    运行脚本
  • 将此添加到appDelegate

    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))
        }
    }