簡體   English   中英

使用FBSDKMessageDialog將消息中的視頻發送給Facebook好友

[英]Send video in message to Facebook friend using FBSDKMessageDialog

我想在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消息對話框中加載視頻

檢查此附件

使用以下代碼。 希望這可以幫到你。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM