TWTRTimelineViewController Craches My app

ios
embeddedtimeline

#1

Hi guys, I just updated my TwitterKit to 1.10.0 and started to develop on XCode7-Beta and my app started to crash. I did not have any problem with the previous version. I am inheriting from “TWTRTimelineViewController”.

Here is the exception it throws,

[UITableViewController loadView] instantiated view controller with identifier "UIViewController-AKp-b6-WZ2" from storyboard "Main", but didn't get a UITableView.'

This is my code:

import UIKit
import TwitterKit
import TSMessages
import iAd


class TwitterViewController: TWTRTimelineViewController {
    enum TweetType {
        case Search
        case TimeLine
        case List
    }

    var type: TweetType? = TweetType.List
    var keyword: String?
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        //navigationController!.navigationBar.translucent = false
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        self.canDisplayBannerAds = true

    
        Twitter.sharedInstance().logInGuestWithCompletion { session, error in
            if let validSession = session {
                let client = Twitter.sharedInstance().APIClient
                if self.type == TweetType.TimeLine {
                    self.dataSource = TWTRUserTimelineDataSource(screenName: self.keyword!, APIClient: client)
                }
                else if self.type == TweetType.List {
                    self.dataSource = TWTRListTimelineDataSource(listID: self.keyword!, APIClient: client)
                }
                else {
                    self.dataSource = TWTRSearchTimelineDataSource(searchQuery: self.keyword!, APIClient: client)
                }
            } else {
                //println(@"error: %@", error.localizedDescription);
            }
        }
	
    
        // Do any additional setup after loading the view.
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func sendTweet(sender: AnyObject) {
        var text : String?
        let composer = TWTRComposer()
        if let k : String! = keyword as String! {
            if type == TweetType.Search {
                let s = k.stringByReplacingOccurrencesOfString(" ", withString: "")
                text = "#\(s) #PathToPresidency"
            }
            else {
                text = "@\(k) #PathToPresidency"
            }
            GoogleAnalytics.sharedInstance().socialInteraction("Twitter", action: "Tweet", target: text!)
         }
    
        composer.setText(text)
        composer.setImage(UIImage(named: "fabric"))
    
    // Called from a UIViewController
         composer.showFromViewController(self) { result in
            if (result == TWTRComposerResult.Cancelled) {
                print("Tweet composition cancelled")
            }
            else {
                print("Sending tweet!")
                TSMessage.showNotificationWithTitle("Congrats", subtitle: "You have said your words via Twitter..", type:TSMessageNotificationType.Success)
            }
        }
    }

}

#2

I found the answer for my problem. I guess developers changed the API a bit. I used to use just UIViewController (On the storyboard) inherited from the TWTRTimelineViewController and it was working with the previous versions of the API. With the last version, I changed all UIViewControllers which shows twitter timeline with UITableViewController on the storyboard and it does not crash anymore.


#4