priore

Fix for Fecebook SDK when retrieving user permissions

Aug 30th, 2013
686
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // fix for Facebook SDK bug (from 3.0 to 3.7.1) https://developers.facebook.com/bugs/111727002307769
  2. - (void)getUserDataPermissionsComplete:(void(^)(NSArray *permissions, NSError *error))completeBlock {
  3.  
  4.     FBRequest *requestPermissions = [FBRequest requestWithGraphPath:@"me/permissions" parameters:Nil HTTPMethod:@"GET"];
  5.     [requestPermissions startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
  6.         if (completeBlock) {
  7.             NSMutableArray *permiss = [NSMutableArray array];
  8.             NSArray *data = [(NSDictionary*)result objectForKey:@"data"];
  9.             if (data && data.count > 0) {
  10.                 NSDictionary *dict = [data objectAtIndex:0];
  11.                 for (NSString *key in dict.allKeys) {
  12.                     if ([[dict objectForKey:key] boolValue]) {
  13.                         [permiss addObject:key];
  14.                     }
  15.                 }
  16.             }
  17.             completeBlock(permiss , error);
  18.         }
  19.     }];
  20. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×