Twitter Composer

Good morning all, I have an issue that I cannot figure out. My self.navigationController is throwing an exception with a nil value when I call the below method. However, calling a similar method for FaceBook works just fine. Any thoughts? I also have tried the below code to initialize the navController. I have also tried to just do composer.show(from:self) with no luck. One other thing I was able to load a tweet into my app from a user ID, so I know the TWTR SKD is functional. Really racking my brain on this for the past two days.

Used this to initialize the navController. self.navController = UINavigationController.init(rootViewController: self)

let composer = TWTRComposer()

composer.setText(“just setting up my Twitter Kit”)
composer.setImage(UIImage(named: “twitterkit”))

// Called from a UIViewController
composer.show(from: self.navigationController!) { (result)in
** if (result == .done) {**
** print(“Successfully composed Tweet”)**
** } else {**
** print(“Cancelled composing”)**
** }**
}

@jjazad Thanks very much for your question!

I think the problem lies in your initialization of your navController:

self.navController = UINavigationController.init(rootViewController: self)

Where is this line being initialized? What precisely is “self”? If this is being done in your AppDelegate, then perhaps this is your error.

This topic was automatically closed after 166 days. New replies are no longer allowed.