iOS: using ShareKit 2.0 to access Facebook. Need to set restriction for alcohol for the app

537 views Asked by At

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?

0

There are 0 answers