File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 428
428
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
429
429
GCC_WARN_UNUSED_FUNCTION = YES;
430
430
GCC_WARN_UNUSED_VARIABLE = YES;
431
- IPHONEOS_DEPLOYMENT_TARGET = 8 .0;
431
+ IPHONEOS_DEPLOYMENT_TARGET = 9 .0;
432
432
MTL_ENABLE_DEBUG_INFO = YES;
433
433
ONLY_ACTIVE_ARCH = YES;
434
434
SDKROOT = iphoneos;
478
478
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
479
479
GCC_WARN_UNUSED_FUNCTION = YES;
480
480
GCC_WARN_UNUSED_VARIABLE = YES;
481
- IPHONEOS_DEPLOYMENT_TARGET = 8 .0;
481
+ IPHONEOS_DEPLOYMENT_TARGET = 9 .0;
482
482
MTL_ENABLE_DEBUG_INFO = NO;
483
483
SDKROOT = iphoneos;
484
484
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Original file line number Diff line number Diff line change @@ -25,12 +25,13 @@ final class WebService {
25
25
URLSession . shared. dataTask ( with: resource. url) { data, response, error in
26
26
// Check for errors in responses.
27
27
let result = self . checkForNetworkErrors ( data, response, error)
28
-
29
- switch result {
30
- case . success( let data) :
31
- completion ( resource. parse ( data) )
32
- case . failure( let error) :
33
- completion ( . failure( error) )
28
+ DispatchQueue . main. async {
29
+ switch result {
30
+ case . success( let data) :
31
+ completion ( resource. parse ( data) )
32
+ case . failure( let error) :
33
+ completion ( . failure( error) )
34
+ }
34
35
}
35
36
} . resume ( )
36
37
}
@@ -49,7 +50,7 @@ extension WebService {
49
50
}
50
51
}
51
52
52
- if let response = response as? HTTPURLResponse , response. statusCode > = 200 && response. statusCode < = 299 {
53
+ if let response = response as? HTTPURLResponse , response. statusCode < = 200 && response. statusCode > = 299 {
53
54
return . failure( ( . invalidStatusCode( " Request returned status code other than 2xx \( response) " ) ) )
54
55
}
55
56
You can’t perform that action at this time.
0 commit comments