This repository is no longer maintained as iOS 11 has removed Twitter and Facebook accounts.
The aim of this demo app is to have a repository of all the common Social Framework methods. The app uses both SLComposeViewController
, SLRequest
and UIActivityViewController
and supports Twitter, Facebook, and Flickr.
Included in this app is the NSString+HTML.h class by Michael Waterfall; the GTMNSString+HTML.h class from Google; and the MBProgressHud.h class created by Matej Bukovinski . Usage of these classes is subject to their respective license agreement.
Additionally, graphics used in this application are from Glyphish (www.glyphish.com). If you like them, buy them.
This is a singleton class used in this demo to manage various elements related to the user's social network accounts.
In the TWBTwitterViewController
's viewDidLoad method, a request is made to the TWBSocialHelper
class for access to the user's Twitter accounts. You should allow access!
All
SLComposeViewController
methods check for an available Twitter account using the isAvailableForServiceType method. If no Twitter account(s) are available a UIAlertView is presented.
All
SLRequest
methods use Twitter API v1.1.
Specifically for
SLRequest
methods, you can select which Twitter account to use via the Account selector. The account highlighted with the Thumbs Up is the currently active account.
This method uses SLComposeViewController
to present Apple's stock tweet sheet for posting to Twitter.
This method uses SLComposeViewController
to present Apple's stock tweet sheet for posting to Twitter. An image from the application bundle is also attached to the tweet.
This method uses SLRequest
to post a tweet with text to the user's timeline. This method will not do anything if access has not been granted. A success alert view is presented if the posting was successful.
This method uses SLRequest
to post a tweet with text and an image to the user's timeline. This method will not do anything if access has not been granted. A success alert view is presented if the posting was successful.
This method returns the users id numbers, e.g. 12345, then requests more data about each user id returned - profile image, screen name, and real name, and then presents a table view with that data. Lots of NSDictionarys and NSArrays.
This method downloads the current authenticated user's timeline (using the default number of tweets). The method parses through the json response and then creates a SBTweetDetails object (a tweet); then pushes a tableview onscreen which displays the tweet.
Facebook requires a separate read and write request to be made for each permission, in respect of methods using SLRequest
. In TWBFacebookViewController
's viewDidLoad
method a request is made for the read permission. Upon success of that method, a write request is made.
For SLRequest methods a Facebook App Identifier is required. This needs to be setup at https://developers.facebook.com. Additionally, the bundle ID of the app must match the bundle ID on the Facebook website.
This method uses SLComposeViewController
to present Apple's stock Facebook post sheet for posting to Facebook.
This method uses SLComposeViewController
to present Apple's stock Facebook post sheet for posting to Facebook. An image from the application bundle is also attached to the post.
This method uses SLRequest
to post an update to the users wall with a message, a link, an image, a caption, a name, and a description. This method needs to be run twice: the first time will request write permission, the second will update the user's wall.
Note, the components of a Facebook update:
There are no SLComposeViewController
methods available for Flickr. The alternative is to use UIActivityViewController
.
This method uses SLComposeViewController
to present Apple's stock Facebook post sheet for posting to Facebook.