iOS 11 - TwitterKit 3 - The presenting view controller dismisses on clicking Done button in the web top left

twitterkit
ios

#1

I am using the following code to compose a tweet ,
let composer = TWTRComposer()
composer.setText(AppSpecific.DealShareUtilities.twitterInitialText(dealDetails))
composer.setURL(shareLinkUrl)
composer.show(from: fromController) { (result) in
if (result == .done) {
print(“Successfully composed Tweet”)
} else {
print(“Cancelled composing”)
}
}

If the user is not logged in , a web view appears asking the user to log in . If clicked on “Done” button on top left , the view controller it is presented from is dismissed and the rootViewController is loaded.


#2

This is happening to me as well. I have a very delicate view controller flow and it is resulting in a bad state as well. Hope it gets fixed soon.


#3

same issue .Im using TwitterKit 3, still have this. Did anyone workaround this issue?


#4

I reported this same behavior in detail in September here: TwitterKit is dismissing callee controller in airplane mode, which didn’t seem to get any official response. May have been because of the title of original post. I ended up creating a hack-y workaround, but would love to see an official response / fix.


#5

What hack-y workaround did you end up doing?


#6

Hi Pavan- I’d hope that this has been fixed, as it was occurring in TwitterKit 3.1.1 and the current version is 3.3.0. But I haven’t verified it myself.

The hack involved setting a boolean property flag on the view controller when performing the twitterkit auth / sharing, and clearing it in the auth / share success callback. Then overriding the dismissViewControllerAnimated:completion: method in the view controller to check the flag like so (Obj-C):

- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
    if (self.stopDismiss) {
        return;
    }
    return [super dismissViewControllerAnimated:flag completion:completion];
}

This effectively blocks the calls to dismiss the presenting VC until the auth / share completes.


#7

Twitter guys , your killing us.

This is still a huge issue we have everywhere.
The solution on top is just irrelevant for us and is a huge hack.