Objective-C Tips & Trick - Prioregroup.com
[Objective-C] Fix for Fecebook SDK when retrieving user permissions
       
back

// fix for Facebook SDK bug (from 3.0 to 3.7.1) https://developers.facebook.com/bugs/111727002307769
- (void)getUserDataPermissionsComplete:(void(^)(NSArray *permissions, NSError *error))completeBlock {

    FBRequest *requestPermissions = [FBRequest requestWithGraphPath:@"me/permissions" parameters:Nil HTTPMethod:@"GET"];
    [requestPermissions startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        if (completeBlock) {
            NSMutableArray *permiss = [NSMutableArray array];
            NSArray *data = [(NSDictionary*)result objectForKey:@"data"];
            if (data && data.count > 0) {
                NSDictionary *dict = [data objectAtIndex:0];
                for (NSString *key in dict.allKeys) {
                    if ([[dict objectForKey:key] boolValue]) {
                        [permiss addObject:key];
                    }
                }
            }
            completeBlock(permiss , error);
        }
    }];
}






Copyright © 1996-2019 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com