Automating the Compose Tweet Dialogue via Fabric for iOS



I implemented twitter on my app via Fabric. I’m trying to automate the process of composing and posting a tweet. When the user presses a button, I want a pre-filled tweet to share automatically. There are two ways I envisioned this going:

1.) Simply automate pressing the button “Post” when the dialogue appears


2.) Directly posting the tweet when the button is pressed, not having the pop-up appear at all

I’m having trouble figuring out how to do either and can’t find access to the pop-up UI contents.
Here is the code that initializes the button and then the actual popup:

    var counter = 1
    @IBAction func Share(_ sender: UIButton) {
        let composer = TWTRComposer()
    counter += 1
    composer.setText("Times I've missed my alarm: \(counter)")
    composer.setImage(UIImage(named: "fabric"))
    // Called from a UIViewController self) { result in
        if (result == TWTRComposerResult.cancelled) {
            print("Tweet composition cancelled")
        else {
            print("Sending tweet!")


Hey @ryzhu75,

While you can pre-fill a tweet on behalf of the user, you cannot automatically send a tweet on their behalf. They need to click the button to send the tweet. Please see the Developer Agreement here: Specifically Section C, Number 4.

If your Service allows users to post Content to Twitter, then, before publishing, show the user exactly what will be published, including whether any geotags will be added to the Content.”



Okay- I found a workaround that should work without the automation, however I’m still having trouble finding the code for the UIAlert dialogue for compose tweet within the Fabric SDK? I would like to change the label of the “Post” button to something else.


The pre-filled text will have to be approved beforehand by the user before executing


Hey @ryzhu75,

Sorry, I should have clarified - currently “Post” can’t be changed. I’m curious though, what do you want to change it to?