iOS-Facebook發送圖文
Facebook SDK version 3.1
//圖片來源
UIImage *image = [UIImage imageNamed:@"image.png"];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:image, @"source",@"這是圖片的描述,可以自己玩玩看",@"message", nil];
if (FBSession.activeSession.isOpen) {
[FBRequestConnection startWithGraphPath:@"me/photos" //@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error) {
// [self showAlert:@"Post Photo" result:result error:error];
}else{
// [poFBLab setText:@"完成發佈!"];
}
}];
}
備註:在iOS 5執行時,沒有問題,但在iOS 6卻會發生逾時,無法發送,後來到facebook App的設定Bundle ID,才解決。