Skip to content

Instantly share code, notes, and snippets.

@priore
Created October 25, 2013 23:36
Show Gist options
  • Save priore/7163444 to your computer and use it in GitHub Desktop.
Save priore/7163444 to your computer and use it in GitHub Desktop.
Fix for Fecebook SDK when retrieving user permissions
// 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);
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment