![](/img/trans.png)
[英]FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS
[英]how to share a Photo Or link on facebook wall without using FBSDKShareDialog from native ios app
我想在不使用FBSDKShareDialog的情況下在用戶Facebook牆上發布一些照片或鏈接。 我已經使用來自Facebook的FBSDKSharePhoto和FBSDKShareDialog默認對話框發布了。 為此,我執行以下代碼
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.imgView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:(id)self];
但是,此代碼將打開“默認FB”對話框。 因此,如何直接在用戶牆上發布鏈接和照片。
您可以使用默認iOS社交框架的SLComposeViewController
#import <Social/Social.h>
- (IBAction)postToFacebook:(id)sender {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"Post from my iPhone app"];
[controller addURL:[NSURL URLWithString:@"http://www.yourlink.com"]];
[controller addImage:[UIImage imageNamed:@"facebook-image.jpg"]];
[controller setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Post Sucessful");
break;
default:
break;
}
}];
[self presentViewController:controller animated:YES completion:Nil];
}
}
Facebook共享文檔。 : https : //developers.facebook.com/docs/sharing/ios
通過圖譜API:
1) 使用圖形API iPhone iPhone SDK在Facebook牆上發布圖像
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.