ios - 使用FBSDKShareDialog

时间:2016-03-30 13:08:22

标签: ios objective-c fbsdk

我有一个应用程序应该在Facebook墙上分享来自Camera Roll的最后一个视频。

我使用的代码是:

PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];
            [fetchOptions setSortDescriptors:[NSArray arrayWithObjects:[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:false], nil]];



        PHFetchResult *fetchResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeVideo options:fetchOptions];

        NSString *videoIdentifier = @"";

        if(fetchResult != nil) {

            if ([fetchResult count] > 0) {
                if ([[fetchResult firstObject] isKindOfClass: [PHAsset class]]) {
                    videoIdentifier = [((PHAsset *)[fetchResult firstObject]) localIdentifier];

                    NSArray *array = [videoIdentifier componentsSeparatedByString:@"/"];

                    NSString *urlAssetString = [NSString stringWithFormat:@"assets-library://asset/asset.MOV?id=%@&ext=MOV", array.firstObject];

                    FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc] init];
                    NSURL *videoURL = [NSURL URLWithString:urlAssetString];

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

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

                    shareDialog.shareContent = content;
                    shareDialog.delegate = self;
                    [shareDialog show];
                }
            }
        }

问题是:

1)不是在应用程序内打开共享对话框,而是打开Facebook应用程序

2)当我确认共享时,会出现带有微调器的黑屏。当微调器达到100%进度时,它仍然在屏幕上。没有调用任何委托方法。

3)帖子最后没有分享/不会出现在墙上

我该怎么办?如果我没有在应用程序中登录Facebook以获得在墙上发布的许可,那会有什么问题吗?

enter image description here enter image description here

0 个答案:

没有答案