我有一个由Mysevers
撰写的Objective-c
网络类,现在我使用的是混合Objective-c
和Swift
项目。
在我的Mysevers
中,我有一种联网方法:
+(void)AFPOSTWithHud:(BOOL)hud andAddressname:(NSString*)addressName parmas:(NSDictionary*)parmas RequestSuccess:(void(^)(id result))success failBlcok:(void(^)(void))failBlcok
{
if (hud) {
[HUD addHUD];
}
AFHTTPSessionManager *requestManager = [AFHTTPSessionManager manager];
NSString *urlStr = [NSString stringWithFormat:@"%@%@",BASE_URL,addressName];
NSLog(@"%@",urlStr);
[requestManager POST:urlStr parameters:parmas progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (hud) {
[HUD removeHUD];
}
success(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
if (error != nil) {
NSLog(@"error==%@",[error localizedDescription]);
if (hud) {
[HUD removeHUD];
}
}
failBlcok();
}];
}
在Swift
控制器中,调用方法,传递一个快速的Bool值false
。
Mysevers.afpost(withHud: false, andAddressname: Global.url_fillMoreInfo, parmas: uploadDict, requestSuccess:{ (result) in
但是,在Mysevers类中,我给出一个断点来检查传递的值,结果是YES
:
(lldb) po hud
YES