fix
This commit is contained in:
@@ -36,12 +36,12 @@
|
||||
[manager GET:url parameters:params progress:^(NSProgress * _Nonnull downloadProgress) {
|
||||
|
||||
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
|
||||
NSLog(@"%@", responseObject);
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
block(dict, headerFields, nil);
|
||||
|
||||
if (responseObject) {
|
||||
NSLog(@"%@", responseObject);
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
block(dict, headerFields, nil);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
@@ -57,12 +57,14 @@
|
||||
[manager POST:url parameters:params progress:^(NSProgress * _Nonnull uploadProgress) {
|
||||
|
||||
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSLog(@"%@", dict);
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
block(dict, headerFields, nil);
|
||||
|
||||
if (responseObject) {
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSLog(@"%@", dict);
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
block(dict, headerFields, nil);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
block(nil, headerFields, error);
|
||||
@@ -88,12 +90,14 @@
|
||||
|
||||
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSLog(@"%@", dict);
|
||||
if (success) {
|
||||
success(responseObject);
|
||||
if (responseObject) {
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSLog(@"%@", dict);
|
||||
if (success) {
|
||||
success(responseObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSLog(@"%@",error);
|
||||
if (failure) {
|
||||
@@ -145,12 +149,18 @@
|
||||
} downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
|
||||
|
||||
} completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
|
||||
|
||||
NSDictionary *responseDic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
|
||||
|
||||
if (completionHandler) {
|
||||
completionHandler(response,responseDic,error);
|
||||
if (responseObject) {
|
||||
NSDictionary *responseDic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
|
||||
|
||||
if (completionHandler) {
|
||||
completionHandler(response,responseDic,error);
|
||||
}
|
||||
}else{
|
||||
if (completionHandler) {
|
||||
completionHandler(nil,nil,error);
|
||||
}
|
||||
}
|
||||
|
||||
}];
|
||||
|
||||
[task resume];
|
||||
@@ -193,12 +203,13 @@
|
||||
} progress:^(NSProgress * _Nonnull uploadProgress) {
|
||||
|
||||
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSLog(@"%@", dict);
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
if (block) {
|
||||
block(dict, headerFields, nil);
|
||||
if (responseObject) {
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
||||
NSLog(@"%@", dict);
|
||||
NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields];
|
||||
if (block) {
|
||||
block(dict, headerFields, nil);
|
||||
}
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
|
||||
Reference in New Issue
Block a user