简体   繁体   English

Facebook分享成就问题

[英]facebook share achievement issue

i'm trying to add share the game achievement with following code. 我正在尝试通过以下代码添加共享游戏成就的信息。 however, i got the error during publishing: error_reason unfinished operation("FBAPIErrorDomain error 100") error_description @"An error occurred during publishing." 但是,我在发布期间收到错误:error_reason未完成的操作(“ FBAPIErrorDomain错误100”)error_description @“发布期间发生错误。” any one have any ideas? 有人有想法么?

// Create share photo by path
NSString* picPath = [NSString stringWithUTF8String:path];
UIImage *img = [UIImage imageWithContentsOfFile: picPath];

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

// Create Object
NSDictionary *properties = @{
                             @"og:type": @"game.achievement",
                             @"og:title": @"Game Achievement Title",
                             @"og:description": @"Game Achievement Desc",
                             @"og:url": @"http://www.baidu.com",
                             @"og:image": @[photo]
                            };
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];

// Create Action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"games.achieves";
//[action setString:@"testtest" forKey:@"achievement"];
[action setObject:object forKey:@"game.achievement"];
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"game.achievement";

// show share dialog
FBSDKShareDialog *_shareDialog = [[FBSDKShareDialog alloc] init];
_shareDialog.delegate = s_shareDelegate;
_shareDialog.shouldFailOnDataError = YES;
_shareDialog.shareContent = content;
_shareDialog.fromViewController = (UIViewController *)[AppController getRootViewController];
[_shareDialog show];

The game:points property is required for game.achievement objects. game:points属性是game.achievement对象所必需的。 Add this to your properties object: 将此添加到您的属性对象:

 @"game:points": @"1",

For reference, see https://developers.facebook.com/docs/reference/opengraph/object-type/game.achievement/ 有关参考,请参阅https://developers.facebook.com/docs/reference/opengraph/object-type/game.achievement/

If the achievement is already given to a user, he cannot achieve it again, who result on a didFailWitgError when using FBSDKShareDialog. 如果已经将成就提供给用户,则他将无法再次实现它,当使用FBSDKShareDialog时,该用户将产生didFailWitgError。 Hope it will help 希望对你有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM