Swift `Twitter.sharedInstance().logIn` crash

ios
login
swift

#1

When I call Twitter.sharedInstance().logIn(completion: TWTRLogInCompletion), my app immediately crashes.

I have:

  • added the setup function to AppDelegate: Twitter.sharedInstance().start(withConsumerKey:"hTpkPVU4pThkM0", consumerSecret:"ovEqziMzLpUOF163Qg2mj") (using my own key and secret)
  • Configured my info.plist with all required keys
  • Installed TwitterKit 3.0.3 via CocoaPods

Running app on a real device (iPhone 7, iOS 10.3.2)
Other SDK calls succeed (ex. Twitter.sharedInstance().sessionStore.session()?.userID)

I get no useful output in the console.

This is an app that was previously using Fabric, but I have removed Fabric from the app and am using the standalone TwitterKit now.


#2

I don’t know if you solved this but I was facing the same issue and solved it.

Since the new TwitterKit 3, you have a few changes to make. You need to read these 2 links.

  1. https://dev.twitter.com/twitterkit/ios/installation
  • You need to transfer your app from Fabric to Twitter app dashboard and get your keys
  • Then change you Info.plist
  1. https://dev.twitter.com/twitterkit/ios/log-in-with-twitter
  • Implement application:openURL:options

Hope this will help.


#3

Thanks for the suggestions, but I have followed all of the steps in these articles already. The only part that did not work for me was the “Connect your TwitterKit apps” step. When I entered my email address at https://apps.twitter.com/migrate to begin the process, I got an error saying I had no apps to connect. I am the admin on my Fabric account, so I’m not sure why I got this error.

I have created an app on the Twitter app dashboard and used my keys to configure my Info.plist. I have also implemented application:openURL:options.

In Fabric, the app I’m having trouble with still shows Twitter in the sidebar under “Tools”. But as I said, the migrator doesn’t work for me.


#4

I’m sorry I can’t help you with that. I remembered I did migrate my app and I guess it worked but I don’t remember the process :confused:


#5

#6

@Esqarrouth Updating to the latest TwitterKit solves this problem.