/CSSocial

CSSocial is an iOS social sharing library supporting Facebook, Twitter and Google+

Primary LanguageObjective-C

CSSocial

CSSocial is an iOS social sharing library supporting Facebook, Twitter and Google+ CSSocial framework was built to make use of social services like Facebook, Twitter or Google+ safe and easy to implement by the programmer. We were frustrated that every time we needed to integrate a social service into the app, each programmer did it his own way and usually spent more than an hour doing so. The decision was to make a one-line-of-code-do-magic solution which took only a couple of minutes to set up and run.

Setup

  • clone the CSSocial.git to CSSocial directory on your Mac
  • open your XCode project where you want to add the social features
  • drag&drop CSSocial.framework to Frameworks - check copy
  • drag&drop CSSocial.plist to Supporting Files - check copy
  • open CSSocial.plist and enter your parameters
IDParameterDescription
1CSSOCIAL_FACEBOOK_APP_IDFacebook App ID
2CSSOCIAL_TWITTER_CONSUMER_KEYTwitter Consumer Key
3CSSOCIAL_TWITTER_CONSUMER_SECRETTwitter Consumer Secret
4CSSOCIAL_FACEBOOK_PERMISSIONS_READFacebook read permissions
5CSSOCIAL_FACEBOOK_PERMISSIONS_PUBLISHFacebook publish permissions
6CSSOCIAL_GOOGLEPLUS_CLIENT_IDGoogle+ Client ID

add the following frameworks to your XCode project

  • Accounts.framework
  • AdSupport.framework
  • CFNetwork.framework
  • MobileCoreServices.framework
  • Security.framework
  • Social.framework
  • SystemConfiguration.framework
  • libsqlite3.0.dylib
  • libz.1.2.5.dylib

Facebook

Posting a message to Facebook wall can be done by calling a single method like this. If you haven't handled the login or permissions process yourself, CSSocial handles it for you automagically:

[CSFacebook postToWall:@"Test"
       completionBlock:^(CSSocialRequest *request, id response, NSError *error)
{

}];

If you assign a handler block, you will receive a response or an error if one has occured during the posting process.

Posting an image with a caption is done like this

[CSFacebook postPhoto:[UIImage imageNamed:@"test"]
              caption:@"test"
      completionBlock:^(CSSocialRequest *request, id response, NSError *error) {

}];

Showing a Facebook dialog (as available depending on the platform )

[CSFacebook showDialogWithMessage:@"test"
                            photo:[UIImage imageNamed:@"test"]
                          handler:^(NSError *error) {

}];

If you assign a handler block, you will receive an error if user cancels the dialog or if something goes wrong while posting.

Twitter

Posting a tweet to Twitter can be done calling a single method like this:

[CSTwitter tweet:@"test"
 completionBlock:^(CSSocialRequest *request, id response, NSError *error) {
}];

Showing a Twitter dialog (as available depending on the platform )

[CSTwitter showDialogWithMessage:@"test"
                           photo:[UIImage imageNamed:@"test"]
                         handler:^(NSError *error) {
}];

If you assign a handler block, you will receive an error if user cancels the dialog or if something goes wrong while posting.

Google+

Showing a Google+ dialog (as available depending on the platform )

[CSGoogle showDialogWithMessage:@"test"
                          photo:[UIImage imageNamed:@"test"]
                        handler:^(NSError *error) {
}];

If you assign a handler block, you will receive an error if user cancels the dialog or if something goes wrong while posting. For more information on errors, see here.