Giorgio Marziani Giorgio Marziani - 1 year ago 140
iOS Question

iOS Facebook SDK - Check Permissions

I have a Facebook SSO working perfectly on my app, using last release of Facebook Objective-C SDK.
I need to ask an extra permission inside the app if user do "something". I don't need to ask that permission if user gave it to me before, so, I guess, in Facebook SDK there should be a method

-(BOOL) checkPermission:(NSString*) permission;

so I can use it like this:

if( [facebook checkPermission:@"email"] ) {

Is there a way to do this?

Answer Source

This question is a bit old but you can now check what permissions the active session has without making a graph request. Here is how it's done in the HelloFacebookSample :

if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {
    // permission does not exist
} else {
    // permission exists

Just replace "publish_actions" with "email".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download