TWTRTimelineViewController shows spinner indefinitely iOS 10

ios
bug
swift
twitterkit

#1

I’m trying to show Twitter timeline using TwitterKit. I’m using XCode 8.1, Swift 3.0 & iOS 10.0.

I created View Controller in my Storyboard, linked it to the my view controller class and tried few code snippets from docs.
I get white view with spinning activity indicator in the middle. That’s it, it never displays twits, activity indicator never disappear. Console log doesn’t show anything.

Here is my code:

AppDelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    Fabric.with([Twitter.self])
}

TwitterTableViewController

import UIKit
import TwitterKit   

class TwitterTableViewController: TWTRTimelineViewController {
    convenience init() {
        let client = TWTRAPIClient()
//        let dataSource = TWTRUserTimelineDataSource(screenName: "fabric", apiClient: client)
        let dataSource = TWTRSearchTimelineDataSource(searchQuery: "#fabricdev", apiClient: client)
        self.init(dataSource: dataSource)
    }
}

#2

Update:
If I move data source creation to the viewDidLoad - I have some stuff in log. Googl doesn’t show anything helpful on that topic:

New code

override func viewDidLoad() {
    super.viewDidLoad()

    let client = TWTRAPIClient()
    self.dataSource = TWTRUserTimelineDataSource(screenName: "fabric", apiClient: client)
}

Log

2016-11-16 23:56:50.685 MyApp[43744:8234642] [TwitterKit] initWithSessionStore:userID: Invalid parameter not satisfying: sessionStore
2016-11-16 23:56:50.686 MyApp[43744:8234642] [TwitterKit] initWithScreenName:APIClient: Invalid parameter not satisfying: client

#3

I’m currently using Swift 2.3 and can provide a sample based on that, but not sure if that would be helpful since you’re using Swift 3.0. Let me know if it would be!

It’s on my list of things to do is to provide updated sample code for Swift 3.

-Mike


#4

Hi Mike,

thanks.
I solved it by re-doing the whle process through Fabric app. The weird part - I used same code. Didn’t add anything.

I believe a lot of problems can be caused by multiple sources of documentation and examples
I was used this one initially:
https://docs.fabric.io/apple/twitter/overview.html

It is different from this one:
https://fabric.io/kits/ios/twitterkit/summary

The second link provides some Twitter provisioning which is missing in the first link (it didn’t help either, but I added it just in case, step where you add keys in Info.plist).


#5

Thanks for letting me know @OgreSwamp - much appreciated! Will share this with the team and work to clarify the setup.

-Mike


#6