Skip to content

Instantly share code, notes, and snippets.

@ekoneil
ekoneil / gist:6813974
Last active December 24, 2015 14:39
[Facebook iOS SDK example] Publish an Open Graph (OG) story that: 1/ uses image staging 2/ creates a custom, user-owned OG object 3/ creates a custom OG action
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) {