Created
August 20, 2012 18:08
-
-
Save ekoneil/3406258 to your computer and use it in GitHub Desktop.
Web Dialogs and the Facebook SDK 3.x for iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Requirements: | |
1/ Manually copy the DeprecatedHeaders folder from the SDK's {install-dir}/FacebookSDK/FacebookSDK.framework/Versions/Current into your project's Supporting Files directory | |
2/ Instantiate an instance of the Facebook class. This class implements the dialog:andParams:andDelegate method. Example: | |
self.facebook = [[Facebook alloc] initWithAppId:@"{app-id}" andDelegate:self]; | |
Note: several dialogs from this list: https://developers.facebook.com/docs/reference/dialogs/ are unsupported on iOS / Android touch devices. The following don't work: | |
1/ add page tab | |
2/ (add) friends | |
3/ send | |
Code examples for displaying a dialog in response to a button click are below for the OAuth, feed, and app request dialogs. | |
*/ | |
// Show the app request dialog. | |
// Supported parameters: | |
// https://developers.facebook.com/docs/reference/dialogs/requests/ | |
- (void) showAppRequestDialog { | |
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: | |
@"[Your app request message here]", | |
@"message", | |
nil]; | |
[self.facebook dialog:@"apprequests" andParams:params andDelegate:self]; | |
} | |
// Show the feed dialog | |
// Supported parameters: | |
// https://developers.facebook.com/docs/reference/dialogs/feed/ | |
- (void)showFeedDialog { | |
// Put together the dialog parameters | |
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: | |
@"Facebook SDK for iOS", @"name", | |
@"Build great social apps and get more installs.", @"caption", | |
@"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", @"description", | |
@"https://developers.facebook.com/ios", @"link", | |
@"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", @"picture", | |
nil]; | |
[self.facebook dialog:@"feed" andParams:params andDelegate:self]; | |
} | |
// Show the oauth dialog | |
// Supported parameters: | |
// https://developers.facebook.com/docs/reference/dialogs/oauth/ | |
- (void) showOauthDialog { | |
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: | |
@"{app-id}", | |
@"client_id", | |
nil]; | |
[self.facebook dialog:@"oauth" andParams:params andDelegate:self]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment