IOS异步处理:
dispatch_async(dispatch_get_global_queue(0, 0), ^{ //这里提示错误:Incompatible block pointer types passing 'BOOL (^)(void)' to parameter of type 'dispatch_block_t _Nonnull' (aka 'void (^)(void)')
return YES;//最终发现错误原因是这里有返回值;
// 处理耗时操作的代码块...
//通知主线程刷新
dispatch_async(dispatch_get_main_queue(), ^{
//回调或者说是通知主线程刷新,
});
});//这里提示错误:Non-void block does not return a value in all control paths
在第一行提示错误:Incompatible block pointer types passing 'BOOL (^)(void)' to parameter of type 'dispatch_block_t _Nonnull' (aka 'void (^)(void)')
在最后一行提示错误:Non-void block does not return a value in all control paths
最终是因为异步处理过程中有返回值,所以导致异步块中莫名其妙的错误。