是否可以使用 Facebook SDK 或 Graph API 创建如下帖子?
我基本上想将这两者结合在一起:
[FBRequestConnection startForUploadPhoto:[UIImage imageNamed:@"myImage"] completionHandler:nil];
[FBRequestConnection startForPostStatusUpdate:@"Hello, World!" completionHandler:nil];
谢谢。
是否可以使用 Facebook SDK 或 Graph API 创建如下帖子?
我基本上想将这两者结合在一起:
[FBRequestConnection startForUploadPhoto:[UIImage imageNamed:@"myImage"] completionHandler:nil];
[FBRequestConnection startForPostStatusUpdate:@"Hello, World!" completionHandler:nil];
谢谢。
使用以下方法:
// Present share dialog
[FBDialogs presentShareDialogWithLink:params.link
name:params.name
caption:params.caption
description:params.description
picture:params.picture
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
} else {
// Success
NSLog(@"result %@", results);
}
}];
尝试这个,
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setObject:UIImagePNGRepresentation(_image) forKey:@"picture"];
if (message) {
[dictionary setObject:message forKey:@"message"];
}
FBRequest *request = [FBRequest requestWithGraphPath:@"me/photos" parameters:dictionary HTTPMethod:@"POST"];
[connection addRequest:request completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
}];
[connection start];