I\'m trying to upload a photo from the camera to a user\'s Facebook wall. I\'m not entirely sure what the correct strategy is, but from reading around it seems the thing to
Using Facebook SDK 3.0:
- (void)postPhotoThenOpenGraphAction {
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
// First request uploads the photo.
FBRequest *request1 = [FBRequest
requestForUploadPhoto:self.selectedPhoto];
[connection addRequest:request1
completionHandler:
^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
}
}
batchEntryName:@"photopost"
];
// Second request retrieves photo information for just-created
// photo so we can grab its source.
FBRequest *request2 = [FBRequest
requestForGraphPath:@"{result=photopost:$.id}"];
[connection addRequest:request2
completionHandler:
^(FBRequestConnection *connection, id result, NSError *error) {
if (!error &&
result) {
NSString *source = [result objectForKey:@"source"];
[self postOpenGraphActionWithPhotoURL:source];
}
}
];
[connection start];
}
They follow this post with an OpenGraph action publish ([self postOpenGraphActionWithPhotoURL:source];), but if you just want the image on the user's wall, you wont need that.
More info: https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/publish-open-graph-story/#step7
Yay!, FB SDK 3.0 rocks! No more AppDelegate.facebook :)