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
UIImage* image = [UIImage imageNamed:@"inspiration-2.jpg"]; // image stored in app's resources | |
// stage an image | |
[FBRequestConnection startForUploadStagingResourceWithImage:image | |
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { | |
if(error) { | |
NSLog(@"Error staging resource.\n%@", error); | |
int code = [[[[[error userInfo] objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:@"body"] objectForKey:@"error"] objectForKey:@"code"]; | |
if(code == 2500) { |
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
curl -X POST \ | |
"https://graph.facebook.com/{id-of-user-or-album}/photos" | |
-F "access_token=$T" \ | |
-F "source=@{path-to-file}" \ | |
-F "message=A black box" |
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
CLLocationManagerDelegate | |
@property (strong, nonatomic) CLLocationManager *locationManager; | |
@property (strong, nonatomic) FBCacheDescriptor *placeCacheDescriptor; | |
// Get the CLLocationManager going. | |
self.locationManager = [[CLLocationManager alloc] init]; | |
self.locationManager.delegate = self; | |
self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; | |
// We don't want to be notified of small changes in location, preferring to use our |
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
- (BOOL)application:(UIApplication *)application | |
openURL:(NSURL *)url | |
sourceApplication:(NSString *)sourceApplication | |
annotation:(id)annotation { | |
// Save the incoming URL to test deep links later. | |
self.openedURL = url; | |
// Work around for app link from FB with valid info. If the session is closed, set the valid info (if any) in the cache | |
if (FBSession.activeSession.state == FBSessionStateCreated || FBSession.activeSession.state == FBSessionStateClosed){ |
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
- (BOOL)application:(UIApplication *)application | |
openURL:(NSURL *)url | |
sourceApplication:(NSString *)sourceApplication | |
annotation:(id)annotation { | |
// Save the incoming URL to test deep links later. | |
self.openedURL = url; | |
// Work around for app link from FB with valid info. If the session is closed, set the valid info (if any) in the cache | |
if (FBSession.activeSession.state == FBSessionStateCreated || FBSession.activeSession.state == FBSessionStateClosed){ |
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 |
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
[FBSettings setLoggingBehavior:[[NSSet alloc] initWithArray:@[FBLoggingBehaviorFBRequests, | |
FBLoggingBehaviorFBURLConnections]]]; |
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
// #1: Graph API: /me | |
- (void)requestMe { | |
[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, | |
NSDictionary<FBGraphUser> *me, | |
NSError *error) { | |
if(error) { | |
[self printError:@"Error requesting /me" error:error]; | |
return; | |
} | |
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
1/ Desktop web Auth Dialog | |
GET https://www.facebook.com/dialog/permissions.request?app_id={fb-app-id}&display=page&next={redirect-url}&response_type=token&fbconnect=1&perms={permissions} | |
2/ Mobile web Auth Dialog | |
GET https://m.facebook.com/dialog/permissions.request?app_id={fb-app-id}&display=touch&next={redirect-url}&response_type=token&fbconnect=1&perms={permissions} | |
3/ Extend access token |
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
#!/bin/bash | |
# Works for stream.publish and open graph actions | |
# Only Me privacy | |
# -F "privacy={'value':'SELF'}" \ | |
# Subset of friends privacy | |
# -F "privacy={'value':'CUSTOM', 'friends':'SOME_FRIENDS', 'allow': 'uid-1,uid-2'}" \ |
NewerOlder