1

I was wondering if theres a way to retrieve the complete text entered by the user in SLComposeViewController. I intend to fetch this value once SLComposeViewControllerCompletionHandler is returned to be True, and pass it as a parameter to Reply Twitter API.

Cheers!!

Jimbo
  • 25,790
  • 15
  • 86
  • 131
holierthanthou84
  • 227
  • 2
  • 12

1 Answers1

0

Officially, you can only "setInitialText:" and can not retrieve the text when the user is done entering it.

If the text were available as a property, then yes you could make use of it when the completion handler is called; but Apple has chosen not to make it available and therefore it's not currently possible through the official API's.

If this is something you need, I'd recommend filing a bug / enhancement request with Apple to ask them to consider it.

Now, all that said, I see that SLComposeViewController does inherit from UIViewController which means you can look at all the subviews of the view owned by the view controller. If you enumerate the subviews, look for the ones that are UITextViews or UITextField and there's where you should be able to find your text.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Hmm thanks Michael!! I think you're right. SLComposeViewController does not have a text property, it rather has `setInitialText` which is not something I'm after. Interesting Idea abt enumeration.. let me try that – holierthanthou84 May 29 '13 at 10:06
  • Sadly i wasn't able to achieve this :( – holierthanthou84 May 29 '13 at 13:10
  • 1
    I managed to fetch the User input from the SLComposeViewController. Like you said SLComposeViewController inherits from UIViewContoller, we need to strip the SLComposeViewcontroller to it UITextView property and fetch its content. Then we pass the gathered info to the Twitter API along with the "in_reply_to_status_id". Easy breezy!! Lemme know if you need help with codes! Spoiler I havent implemented it yet.. but since i was able to retrieve the user input from SLComposerViewController, I assume rest of it will be a piece of cake. Thanks Michael for pointing me at the right direction!! – holierthanthou84 May 29 '13 at 16:37
  • @holierthanthou84, I need your help :) I have to get to the user input tweet text so I can store it in my backend. That way I don't have to fetch users latest tweet. Can you please post your code somewhere? – budiDino Jun 10 '14 at 13:40
  • @budidino Hey mate. Did you check this code out? http://stackoverflow.com/questions/16815180/is-there-a-way-of-replying-to-a-particular-tweet-via-slcomposerviewcontroller This was for iOS6, Obviously iOS7 has changed a lot of things especially the way they layer their interface. You will need to iterate through the layers and fetch the required one. – holierthanthou84 Jun 10 '14 at 14:00
  • @holierthanthou84, thanks. I just realised I need more than just retrieval of the tweeted text. Posted a question here: http://stackoverflow.com/questions/24143286/slcomposeviewcontroller-get-the-user-that-made-the-tweet-and-the-message-tweeted – budiDino Jun 10 '14 at 14:15
  • @holierthanthou84 did you find a solution? – Sam Nov 08 '16 at 06:17