ios - 使用 FBSDKMessageDialog 将视频消息发送给 Facebook 好友

标签 ios objective-c facebook fbsdkmessengersharekit

我想使用我的应用向 Facebook 消息中的 Facebook 好友发送视频。

我正在使用以下代码,

#pragma mark Social Network
- (void)fbSendVideoInMsg{

NSURL *videoURL = [NSURL URLWithString:[self.flyer getVideoAssetURL]];

//video url going fine, bellow is the value
//videoURL:assets-library://asset/asset.mov?id=BD3B188B-6D7E-436C-87D1-FA718282A5C1&ext=mov

FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;

FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;


FBSDKMessageDialog *shareFB = [[FBSDKMessageDialog alloc] init];
if ([shareFB canShow]) {
    shareFB.shareContent = content;

    shareFB.delegate = self;
    [shareFB show];
}
else{

    UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"can't show the share dialog box" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil ];

    [alert show];

  }
}

它没有在 Facebook 消息对话框中加载视频

check this attachment

最佳答案

使用以下代码。希望这对您有所帮助。

NSString *filepath = [[NSBundle mainBundle] pathForResource:@"VideoName" ofType:@"VideoExtension"];
NSData *videoData = [NSData dataWithContentsOfFile:filepath];
[FBSDKMessengerSharer shareVideo:videoData withOptions:nil];

关于ios - 使用 FBSDKMessageDialog 将视频消息发送给 Facebook 好友,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32712098/

相关文章:

objective-c - 比较 Objective-C 中的时间和日期

android - 安装 Facebook 应用程序时出现适当的 Facebook 登录错误

javascript - 如何在开发者api2.4中获取facebook好友列表

ios - 将Title设置为按钮并在单击两次时再次返回第一个标题

iphone - 电影中的字幕显示

ios - 移动到新屏幕时删除实体内容 : iOS7

ios - UIViewController 没有成员 'method'

ios - 从对象数组中分组的 UITableView

ios - 基于 UIBezierPath 改变 UIImageView 的位置

javascript - 在 PhoneGap 中显示 facebook 用户图像 (Android)