小编Kun*_* Hu的帖子

如何获得块的名称?

我们有

typedef id(^func)(id);
func read_file = ^(NSString *path_to_file) {
     return [NSString stringWithContentsOfFile:path_to_file encoding:NSUTF8StringEncoding error:NULL];
};
Run Code Online (Sandbox Code Playgroud)

我想知道如果我在一些函数调用中将它作为参数传递,我们怎么能得到这个块的名字?例如,

fileOperator(read_file); // I want to print the block's name in this function.
Run Code Online (Sandbox Code Playgroud)

谢谢.

objective-c objective-c-blocks

1
推荐指数
1
解决办法
68
查看次数

标签 统计

objective-c ×1

objective-c-blocks ×1