1

我正在开发一个基本的游戏应用程序,我想在其中使用 facebook 更新的 sdk 与 facebook 页面上的默认文本共享我的获胜分数屏幕。我编写了共享屏幕截图的代码,但我无法添加默认文本。如果有人解决这个问题,我将非常感激。这是我用来分享屏幕截图的代码。

- (IBAction)fbSharing:(id)sender {

    UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
    CGRect rect = [keyWindow bounds];
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [keyWindow.layer renderInContext:context];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
    photo.image =img;
    photo.userGenerated = YES;

    FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
    content.photos = @[photo];


    FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
    dialog.fromViewController = self;
    dialog.shareContent = content;
    dialog.mode = FBSDKShareDialogModeNative;
    dialog.fromViewController = self;


    if (![dialog canShow]) {
        dialog.mode = FBSDKShareDialogModeNative;
    }
    [dialog show];
}
4

0 回答 0