Search code examples
iosios6social-framework

iOS6 Social framework: posting to multiple networks without the UI


In my app, I'm looking to allow my users to post a single status to both Facebook and Twitter. I've got my own compose window, so I'd like to avoid using the built-in SLComposeViewController, since it's not necessary.

In my searches, I've not found any good tutorials on how to directly post to either Twitter or Facebook using the iOS6 stuff, it's all with the built-in composer, and the docs have proven somewhat obtuse to my weary eyes.

Any pointers to tutorials, sample code, or even a pointer in the right direction would be appreciated.


Solution

  • Grab both the user's Twitter and Facebook accounts from ACAccountStore, and then just make two calls to SLRequest--one for your Twitter post and another for Facebook.

    Here's the class reference for SLRequest.

    And check out these examples for Facebook and Twitter.

    It's also worth noting that Facebook has their own SDK alternative to SLRequest, which allows for more customization of requests to include FQL, batch requests, etc. Depending on the specificity of your requirements, you may want to check it out.