This project based on https://github.com/doubleencore/DETweetComposeViewController
Facebook connection based on SDK 3.1 (last at 25 september 2012)
What is it? DEFacebookComposeViewController is an iOS 4 compatible. Looks like as the Facebook Sheet in iOS 6.
How to use
-
download and setup Facebook sdk https://developers.facebook.com/ios/ or from git https://github.com/facebook/facebook-ios-sdk
-
register your app on http://developers.facebook.com
-
replace on your app id in plist file. FacebookAppID and in CFBundleURLTypes
-
#import "DEFacebookComposeViewController.h"
-
example of usage
DEFacebookComposeViewControllerCompletionHandler completionHandler = ^(DEFacebookComposeViewControllerResult result) {
switch (result) {
case DEFacebookComposeViewControllerResultCancelled:
NSLog(@"Facebook Result: Cancelled");
break;
case DEFacebookComposeViewControllerResultDone:
NSLog(@"Facebook Result: Sent");
break;
}
[self dismissModalViewControllerAnimated:YES];
};
DEFacebookComposeViewController *facebookViewComposer = [[DEFacebookComposeViewController alloc] init];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[facebookViewComposer setInitialText:@"Look on this"];
[facebookViewComposer addImage:[UIImage imageNamed:@"1.jpg"]];
facebookViewComposer.completionHandler = completionHandler;
[self presentViewController:facebookViewComposer animated:YES completion:^{ }];
- add this code to your main class and you should be sure if app is entered to this method
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBSession.activeSession handleOpenURL:url];
}
Post on my blog http://www.developers-life.com/facebook-compose-view.html Welcome for any questions
If you liked it, you can support me: