iOS Twitter Auth/ logInbutton creates error when clicked: libc++abi.dylib: terminating with uncaught exception of type NSException

ios
auth
xcode
swift

#1

Hello,

I’m currently porting an Android app over to iOS. I am using the login button, which has to be added programmatically (can’t use storyboard). When ever i click it, I get a Thread 1 SIGABRT error reflecting back to my AppDelegate file.

I’ve been racking my brain over why this is happening. I installed TwitterKit using cocoa pods and manually added the TwitterKitResources.bundle file to “Copy Bundle Resources”. From what I’ve researched, this should be due to a unaccounted for outlet in storyboard, but since I’m adding this programmatically, I can’t really check that. None of the code attached to my loginButton executes when clicked

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate{

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    FirebaseApp.configure()
    Twitter.sharedInstance().start(withConsumerKey:" r*********R", consumerSecret:"6*************m")
    
    
    
    
    // Override point for customization after application launch.
    return true
}

and for the LoginViewController

 import UIKit
import Firebase
 import FirebaseAuth
import TwitterKit
import SafariServices

class LoginController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    let logInButton = TWTRLogInButton(logInCompletion: { session, error in
        if (session != nil) {
            print("signed in as \(String(describing: session?.userName))");
        } else {
            print("error: \(String(describing: error?.localizedDescription))");
        }
    })
    logInButton.center = self.view.center
    self.view.addSubview(logInButton)
    print("stuff")
    // Do any additional setup after loading the view.
}
}

Any insights would be greatly appreciated!

Thanks!


#2

I was able to resolve issue by creating a new xcode project