Incompatible block pointer types

2019-11-01  本文已影响0人  跃文
[session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
    
    if(data.length == 8)
    {
        w = ...
        h = ...
        return CGSizeMake(w, h);
    }
    return CGSizeZero;
}];

错误信息:Incompatible block pointer types sending 'CGSize (^)(NSData * _Nullable __strong, NSURLResponse * _Nullable __strong, NSError * _Nullable __strong)' to parameter of type 'void (^ _Nonnull)(NSData * _Nullable __strong, NSURLResponse * _Nullable __strong, NSError * _Nullable __strong)'

产生原因 :block 中调用return 导致 , 解决办法就是去掉返回改用其他方式回调数据

上一篇 下一篇

猜你喜欢

热点阅读