当前位置: 动力学知识库 > 问答 > 编程问答 >

facebook - Register Achievement ok, Create Achievement Returns false

问题描述:

I've just started implementing FB Achievements for my Game. I'm using the PHP SDK for my app.

I've successfully registered an Achievement using the following code from my class which subclasses the PHP SDK class:

$URL = 'apps.facebook.com/<app_name>/ach1.html';

$AppID = $this->getAppId();

$Params = array('achievement' => $URL);

$res = $this->api($AppID.'/achievements', 'POST', $Params);

I can confirm this has been created via the Graph API Explorer:

{

"data": [

{

"url": "http://apps.facebook.com/<app_name>/ach1.html",

"type": "game.achievement",

"title": "Tutorial",

"image": [

{

"url": "<app_img_url>/1-ach.jpg"

}

],

"description": "Tutorial Completed",

"site_name": "<app_name>",

"data": {

"points": 1

},

"updated_time": "2012-07-13T16:05:44+0000",

"id": "<id>",

"application": {

"id": "<app_id>",

"name": "<app_name>",

"url": "https://www.facebook.com/apps/application.php?id=<app_id>"

},

"context": {

"display_order": 0

}

}

]

}

However when I try to create an achievement for myself it returns false:

$URL = 'apps.facebook.com/<app_name>/ach1.html';

$UserID = 100000466230867;

$AccessToken = $this->getApplicationAccessToken();

$Params = array('access_token' => $AccessToken,

'method' => 'post',

'achievement' => $URL);

$res = $this->api($UserID.'/achievements', 'POST', $Params);

The result is "boolean false". No error code is returned. Am I doing something obviously or fundamentally wrong here? I've tried providing a 'display_order' of value 1 and 0 aswell.

I can confirm I've granted the publish_actions permission aswell.

permissions:Array ( [data] => Array ( [0] => Array ( [installed] => 1 [email] => 1 [publish_actions] => 1 [bookmarked] => 1 ) ) )

My app is correctly configured as a game aswell.

Any help greatly appreciated!!

Cheers

网友答案:
  1. If the app is in sandbox mode, take it out.
  2. Ensure the user has authorised & hasn't removed the app

'false' usually means 'Person or page whose access token you're using can't see the data you're asking for', This happens most often for blocked users, apps in sandbox mode, deleted content, etc In this case, i suspect the app can't see / interact with the user (if this a test user created via the app settings interface or API this is especially likely as test users have some strange privacy quirks)

分享给朋友:
您可能感兴趣的文章:
随机阅读: