iOS:使用ShareKit 2.0访问Facebook。需要为应用设置酒精限制
我正在为一家酒精相关公司开发一个 iOS 应用程序。该应用程序是一种寻宝游戏。他们希望应用程序用户在发现他们散布的虚拟对象之一时能够上传到 Facebook。
我正在使用 ShareKit 2.0(github 的分支)来访问 Facebook。
我需要将该应用程序标记为受酒精类型限制。是否可以在应用程序的 Facebook 开发者网站上完成一次此操作,还是应用程序每次登录时都必须执行此操作?
我发现
http://developers.facebook.com/docs/reference/rest/ admin.setRestrictionInfo/
在测试控制台中,我在弹出窗口中将应用程序设置为我的应用程序,并输入
{"type":"alcohol"}。
但我得到了一个错误,自从提出请求以来,这对我来说似乎很奇怪显示 access_token
{
"error_code": 15,
"error_msg": "This method must be called with an app access_token.",
"request_args": [
{
"key": "restriction_str",
"value": " {"type":"alcohol"}."
},
{
"key": "method",
"value": "admin.setRestrictionInfo"
},
{
"key": "access_token",
"value": "AAAC9ngVeKI4BAMkOq14ogA3fKMS6 -- blah blah -- ZCqK5LR"
},
{
"key": "format",
"value": "json"
}
]
}
我不知道这需要如何完成。
预计到达时间:所以我发现了这个: http://developers.facebook.com/docs /reference/api/application/#restrictions
和这个:
http://developers.facebook .com/blog/post/574
我尝试使用我的 appID 和使用浏览器获得的 access_token 执行该操作,然后我得到了
{
"error": {
"message": "(#15) This method is not supported for native apps",
"type": "OAuthException"
}
}
该应用程序是一个本机应用程序(iOS 也将有一个 Android 版本)。所以我仍然不确定如何为此应用程序设置 type=alcohol 的限制标志。
ETA v2:所以我暂时关闭了本机应用程序指定并执行了以下操作
https://graph.facebook.com/MYAPPID?restrictions={"type":"alcohol"}&method=post&access_token=MYAPPID|MYACCESSTOKEN
当我今天早些时候第一次执行此操作时,我收到了有关格式问题的错误。但我刚刚重新编写了它(浏览器中仍然存在相同的查询),它似乎有效。查询限制显示有酒精。
所以我想这已经完成并且正在工作。但是,如果我将应用程序重置为“本机”应用程序,它会清除该设置。但如果我在开发者 Facebook 设置上将其保留为 Web 应用程序,它似乎会保留,并且我的 iOS 应用程序似乎仍然能够发布。
这是它应该工作的方式还是有更好的方式?
I am developing an iOS app for an alcohol related company. The app is a sort of treasure hunt, kind of. They want the app user to be able to upload to Facebook when they find one of the virtual objects that they have scattered around.
I am using ShareKit 2.0 (the offshoot from github) for Facebook access.
I need to mark the app as restricted by type alcohol. Can this be done once on the Facebook developer site for the app or does the app have to do it when it logs in each time?
I found
http://developers.facebook.com/docs/reference/rest/admin.setRestrictionInfo/
In the test console I set the APP to my app in the popup, and put in
{"type":"alcohol"}.
But I get back an error, which seems strange to me since the request shows an access_token
{
"error_code": 15,
"error_msg": "This method must be called with an app access_token.",
"request_args": [
{
"key": "restriction_str",
"value": " {"type":"alcohol"}."
},
{
"key": "method",
"value": "admin.setRestrictionInfo"
},
{
"key": "access_token",
"value": "AAAC9ngVeKI4BAMkOq14ogA3fKMS6 -- blah blah -- ZCqK5LR"
},
{
"key": "format",
"value": "json"
}
]
}
I am not sure how this needs to be done.
ETA: so I found this: http://developers.facebook.com/docs/reference/api/application/#restrictions
and this:
http://developers.facebook.com/blog/post/574
And I tried executing that using my appID and the access_token I got using a browser and I got back
{
"error": {
"message": "(#15) This method is not supported for native apps",
"type": "OAuthException"
}
}
The app is a native app (iOS and there will also be an Android version). So I am still not sure on how to set the restriction flag of type=alcohol for this app.
ETA v2: So I temporarily turned of the native app designation and did the following
https://graph.facebook.com/MYAPPID?restrictions={"type":"alcohol"}&method=post&access_token=MYAPPID|MYACCESSTOKEN
When I first did it earlier today, I got back an error about a format problem. But I just redid it (same query still in the browser), and it seemed to work. Querying for restrictions shows alcohol.
So I guess this is set and done and working. However, if I go reset the app to be a "native" app, it wipes out the setting. But if I leave it a web app on the Developer Facebook settings, it seems to stay, and my iOS app still seems to be able to post.
Is this the way it is supposed to work or is there a better way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论