我想使用以下代码在 Facebook Messenger 中分享我的 iOS 应用程序中的视频:
NSURL *videoURL = [NSURL fileURLWithPath:[self.myViewController getSharingVideoPath]];
FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;
[FBSDKShareDialog showFromViewController:self withContent:content delegate:nil];
这是 videoURL 的输出:
file:///private/var/mobile/Containers/Data/Application/13D19738-5F9E-4C77-A502-0E18F5D09A10/Documents/anonymous/MyApp/144229926301/MyVideo.mov
当我运行时,没有错误,但 Facebook Messenger 没有打开。
我从
https://developers.facebook.com/docs/sharing/ios
这是
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *videoURL = [info objectForKey:UIImagePickerControllerReferenceURL];
FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;
}