Define a block
typedef void (^onListLoadCompleted)(NSString *strScore);
Method Call
[self getFacebookDetails:^(NSString *strScore) {
NSLog(@"%@",strScore);
}];
Block Function
-(void)getFacebookDetails:(onListLoadCompleted)block{
__block int parseScore = 0;
[FBRequestConnection startWithGraphPath:@"me/scores"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error){
parseScore = [[PreferenceHelper sharedHelper] getInt:@"highscore"];
NSLog(@"%d",parseScore);
block(parseScore);
} else {
NSLog(@"failed");
block(@"failed");
}
}];
}