Swift中的一个网络方法:
func OCDataRequestWithString(urlString:String,parameters: [String : Any],successs: @escaping (Int,String?) -> Void) {
PostapiNew(urlString, parameters) { netStatus,json in
if let json = json{
successs(netStatus,json.description)
}else{
successs(netStatus,nil)
}
}
}
项目中对应的OC.h文件中的名称为:
- (void)OCDataRequestWithStringWithUrlString:(NSString * _Nonnull)urlString parameters:(NSDictionary<NSString *, id> * _Nonnull)parameters successs:(void (^ _Nonnull)(NSInteger, NSString * _Nonnull))successs;
错误信息:
Incompatible block pointer types sending 'void (^)(int, NSString *__strong)' to parameter of type 'void (^ _Nonnull)(NSInteger, NSString * _Nonnull __strong)'
改为NSInteger类型错误解决
[[[model_identifyCode alloc] init] OCDataRequestWithStringWithUrlString:SaveBankInfoUrl parameters:[tempModle bindBankCardDic] successs:^(NSInteger netStatus,NSString * string) {
}];