如何将typedef void传递给方法
我有一个typedef
typedef void (^FBLoginHandler)(id <FaceBook>,bool,NSError *error);
FBLoginHandler testHandler;
^(id<FBLoginHandler>, bool, NSError *)error
[login log:@"AccessToken" handler:^(id<FBLoginHandler>, bool, NSError *)error];
任何人都可以建议我如何将typedef值传递给方法
[login log:@"AccessToken" handler:???];
答案 0 :(得分:2)
[login log:@"AccessToken" handler:^(id<FaceBook> object, bool trueOrFalse, NSError *error){
// ... do whatever you'd like to do here.
}];
...或
void ^(handlerBlock)(id<FaceBook>, bool, NSError *) = ^(id<FaceBook> object, bool trueOrFalse, NSError *error) {
// ... do whatever you'd like to do here
};
[login log:@"AccessToken" handler:handlerBlock];
...或
[login log:@"AccessToken" handler:nil];