- Share to Facebook, Twitter or Email and attach an image!
- Supports "Single Click Sharing" - BMSocialShare logs your user in to Facebook, in case no credentials are provided and sends the post afterwards.
- Share full size images to Facebook walls
- BMSocialShare is available as framwork for simple integration or as a static library for more advanced use cases
Questions? Contact me on Twitter @vinzenzweber
- Download BMSocialShare.framework!
- Drag'n drop the
BMSocialShare.framework
folder into your Xcode project - Add
MessageUI.framework
for Email to work - Add
Twitter.framework
for Twitter to work
- In your git repository's root folder do
git submodule add git@github.com:blockhaus/BMSocialShare.git
- Afterwards download all submodules
git submodule update --init --recursive
- Now follow the instructions in the screenshots:
- Create an App on Facebook http://developers.facebook.com/apps
- Copy your Facebook APP ID
- In Xcode right click on your
Info.plist
, chooseOpen As -> Source Code
- 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>
- Add
#import <BMSocialShare/BMSocialShare.h>
to yourAppDelegate.m
- Overwrite
handleOpenURL:
andapplicationDidBecomeActive:
in yourAppDelegate.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];
}
- 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];
- Or share an image in full size:
BMFacebookPost *post = [[BMFacebookPost alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
[[BMSocialShare sharedInstance] facebookPublish:post];
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];
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];
- This framework was created based on https://github.com/kstenerud/iOS-Universal-Framework.
- Graphics in the Examples were taken from http://365psd.com/day/240/ and http://subtlepatterns.com/