Giter VIP home page Giter VIP logo

cssocial's Introduction

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.

cssocial's People

Contributors

markohlebar avatar

Stargazers

Naresh Srirangam avatar

Watchers

James Cloos avatar Naresh Srirangam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.