是否可以使用Facebook SDK或Graph API创建如下所示的帖子?
我基本上想把这两者结合起来:
[FBRequestConnection startForUploadPhoto:[UIImage imageNamed:@"myImage"] completionHandler:nil];
[FBRequestConnection startForPostStatusUpdate:@"Hello, World!" completionHandler:nil];
感谢。
答案 0 :(得分:1)
使用以下方法:
// 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);
}
}];
答案 1 :(得分:0)
试试这个,
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];