美文网首页
Incompatible block pointer types

Incompatible block pointer types

作者: 跃文 | 来源:发表于2019-11-01 15:56 被阅读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 导致 , 解决办法就是去掉返回改用其他方式回调数据

    相关文章

      网友评论

          本文标题:Incompatible block pointer types

          本文链接:https://www.haomeiwen.com/subject/fgzfbctx.html