【问题标题】:Send video in message to Facebook friend using FBSDKMessageDialog使用 FBSDKMessageDialog 向 Facebook 朋友发送视频消息
【发布时间】:2015-09-22 22:52:17
【问题描述】:

我想在 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 消息对话框中加载视频

【问题讨论】:

    标签: ios objective-c facebook fbsdkmessengersharekit


    【解决方案1】:

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

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

    【讨论】:

    • 很好,但 FBSDKMessengerSharer 用于在 Facebook 墙上分享。就我而言,我想通过私信发送视频
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-28
    • 2011-07-26
    • 1970-01-01
    • 2011-10-19
    • 1970-01-01
    • 1970-01-01
    • 2014-04-24
    相关资源
    最近更新 更多