Skip to content

AkademieOlympia/BMSocialShare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BMSocialShare

  1. Share to Facebook, Twitter or Email and attach an image!
  2. Supports "Single Click Sharing" - BMSocialShare logs your user in to Facebook, in case no credentials are provided and sends the post afterwards.
  3. Share full size images to Facebook walls
  4. BMSocialShare is available as framwork for simple integration or as a static library for more advanced use cases

Questions? Contact me on Twitter @vinzenzweber

Facebook iPhone

Quick install: Use the framework version

  1. Download BMSocialShare.framework!
  2. Drag'n drop the BMSocialShare.framework folder into your Xcode project
  3. Add MessageUI.framework for Email to work
  4. Add Twitter.framework for Twitter to work

Advanced install: Use the static library

  1. In your git repository's root folder do git submodule add git@github.com:blockhaus/BMSocialShare.git
  2. Afterwards download all submodules git submodule update --init --recursive
  3. Now follow the instructions in the screenshots:

Xcode screenshot Xcode screenshot Xcode screenshot Xcode screenshot Xcode screenshot

Facebook

  1. Create an App on Facebook http://developers.facebook.com/apps
  2. Copy your Facebook APP ID
  3. In Xcode right click on your Info.plist, choose Open As -> Source Code
  4. Insert the following snippet with your own Facebook APP ID:
    <key>CFBundleURLTypes</key>
    <array>
    <dict>
    <key>CFBundleURLName</key>
    <string></string>
    <key>CFBundleURLSchemes</key>
    <array>           
    <string>fb123456789012345</string>
    </array>
    </dict>
    </array>

plist source

  1. Add #import <BMSocialShare/BMSocialShare.h> to your AppDelegate.m
  2. Overwrite handleOpenURL: and applicationDidBecomeActive: in your AppDelegate.m
    // for iOS prior 4.2
    - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
        return [[BMSocialShare sharedInstance] facebookHandleOpenURL:url];
    }
    
    // for iOS > 4.2 make sure you use
    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
        return [[BMSocialShare sharedInstance] facebookHandleOpenURL:url];
    }
    
    // extend the access token
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        [[BMSocialShare sharedInstance] facebookExendAccessToken];
    }
  1. Post to Facebook:
    BMFacebookPost *post = [[BMFacebookPost alloc] 
                            initWithTitle:@"Simple sharing via Facebook, Email and Twitter for iOS!" 
                            descriptionText:@"Posting to Facebook, Twitter and Email made dead simple on iOS. Simply include BMSocialShare as a framework and you are ready to go." 
                            andHref:@"https://github.com/blockhaus/BMSocialShare"];    
    
    [post setImageUrl:@"http://www.blockhausmedien.at/images/logo-new.gif" 
             withHref:@"http://www.blockhaus-media.com"];
    
    [post addPropertyWithTitle:@"Download" 
               descriptionText:@"github.com/blockhaus/BMSocialShare" 
                       andHref:@"http://github.com/blockhaus/BMSocialShare"];
    
    [post addPropertyWithTitle:@"Developed by" 
               descriptionText:@"blockhaus" 
                       andHref:@"http://www.blockhaus-media.com"];

    [[BMSocialShare sharedInstance] facebookPublish:post];
  1. Or share an image in full size:
    BMFacebookPost *post = [[BMFacebookPost alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
    [[BMSocialShare sharedInstance] facebookPublish:post];

Twitter

So far only iOS5+ is supported!

    [[BMSocialShare sharedInstance] twitterPublishText:@"Posting to Facebook, Twitter and Email made dead simple on iOS with BMSocialShare"
                                             withImage:nil
                                                andURL:[NSURL URLWithString:@"http://github.com/blockhaus/BMSocialShare"]
                                inParentViewController:self];

EMail

    NSString *storePath = [[NSBundle mainBundle] pathForResource:@"blockhaus" ofType:@"png"];
        
    [[BMSocialShare sharedInstance] emailPublishText:@"Posting to Facebook, Twitter and Email made dead simple on iOS. Simply include BMSocialShare as a framework and you are ready to go.\nhttp://github.com/blockhaus/BMSocialShare"
                                              isHTML:YES
                                         withSubject:@"Simple sharing with BMSocialShare"
                                           withImage:storePath 
                              inParentViewController:self];

Apps using BMSocialShare

Third Party

About

Share via Facebook, Twitter and Email! All in a single framework bundle for iOS!

Resources

License

Stars

Watchers

Forks

Packages

No packages published