Authored by Florent Vilmart

Replaces direct calls to UIApplication by peformSelector

@@ -1095,6 +1095,7 @@ @@ -1095,6 +1095,7 @@
1095 4A2CAE131AB4BB5400B6BC39 /* Debug */ = { 1095 4A2CAE131AB4BB5400B6BC39 /* Debug */ = {
1096 isa = XCBuildConfiguration; 1096 isa = XCBuildConfiguration;
1097 buildSettings = { 1097 buildSettings = {
  1098 + APPLICATION_EXTENSION_API_ONLY = YES;
1098 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 1099 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1099 CLANG_CXX_LIBRARY = "libc++"; 1100 CLANG_CXX_LIBRARY = "libc++";
1100 CLANG_ENABLE_MODULES = YES; 1101 CLANG_ENABLE_MODULES = YES;
@@ -1141,6 +1142,7 @@ @@ -1141,6 +1142,7 @@
1141 4A2CAE141AB4BB5400B6BC39 /* Release */ = { 1142 4A2CAE141AB4BB5400B6BC39 /* Release */ = {
1142 isa = XCBuildConfiguration; 1143 isa = XCBuildConfiguration;
1143 buildSettings = { 1144 buildSettings = {
  1145 + APPLICATION_EXTENSION_API_ONLY = YES;
1144 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 1146 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1145 CLANG_CXX_LIBRARY = "libc++"; 1147 CLANG_CXX_LIBRARY = "libc++";
1146 CLANG_ENABLE_MODULES = YES; 1148 CLANG_ENABLE_MODULES = YES;
@@ -1232,6 +1234,7 @@ @@ -1232,6 +1234,7 @@
1232 53761323155AD0D5005750A4 /* Debug */ = { 1234 53761323155AD0D5005750A4 /* Debug */ = {
1233 isa = XCBuildConfiguration; 1235 isa = XCBuildConfiguration;
1234 buildSettings = { 1236 buildSettings = {
  1237 + APPLICATION_EXTENSION_API_ONLY = NO;
1235 CLANG_ENABLE_OBJC_ARC = YES; 1238 CLANG_ENABLE_OBJC_ARC = YES;
1236 COPY_PHASE_STRIP = NO; 1239 COPY_PHASE_STRIP = NO;
1237 DEAD_CODE_STRIPPING = NO; 1240 DEAD_CODE_STRIPPING = NO;
@@ -1255,6 +1258,7 @@ @@ -1255,6 +1258,7 @@
1255 53761324155AD0D5005750A4 /* Release */ = { 1258 53761324155AD0D5005750A4 /* Release */ = {
1256 isa = XCBuildConfiguration; 1259 isa = XCBuildConfiguration;
1257 buildSettings = { 1260 buildSettings = {
  1261 + APPLICATION_EXTENSION_API_ONLY = NO;
1258 CLANG_ENABLE_OBJC_ARC = YES; 1262 CLANG_ENABLE_OBJC_ARC = YES;
1259 COPY_PHASE_STRIP = NO; 1263 COPY_PHASE_STRIP = NO;
1260 DEAD_CODE_STRIPPING = NO; 1264 DEAD_CODE_STRIPPING = NO;
@@ -1415,6 +1419,7 @@ @@ -1415,6 +1419,7 @@
1415 4A2CAE141AB4BB5400B6BC39 /* Release */, 1419 4A2CAE141AB4BB5400B6BC39 /* Release */,
1416 ); 1420 );
1417 defaultConfigurationIsVisible = 0; 1421 defaultConfigurationIsVisible = 0;
  1422 + defaultConfigurationName = Release;
1418 }; 1423 };
1419 531041DD157EAFA400BBABC3 /* Build configuration list for PBXNativeTarget "SDWebImage+MKAnnotation" */ = { 1424 531041DD157EAFA400BBABC3 /* Build configuration list for PBXNativeTarget "SDWebImage+MKAnnotation" */ = {
1420 isa = XCConfigurationList; 1425 isa = XCConfigurationList;
@@ -478,7 +478,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { @@ -478,7 +478,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
478 if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { 478 if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) {
479 return; 479 return;
480 } 480 }
481 - UIApplication *application = [UIApplication sharedApplication]; 481 + UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)];
482 __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{ 482 __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
483 // Clean up any unfinished task business by marking where you 483 // Clean up any unfinished task business by marking where you
484 // stopped or ending the task outright. 484 // stopped or ending the task outright.
@@ -74,13 +74,14 @@ @@ -74,13 +74,14 @@
74 BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)]; 74 BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)];
75 if (hasApplication && [self shouldContinueWhenAppEntersBackground]) { 75 if (hasApplication && [self shouldContinueWhenAppEntersBackground]) {
76 __weak __typeof__ (self) wself = self; 76 __weak __typeof__ (self) wself = self;
77 - self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ 77 + UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)];
  78 + self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{
78 __strong __typeof (wself) sself = wself; 79 __strong __typeof (wself) sself = wself;
79 80
80 if (sself) { 81 if (sself) {
81 [sself cancel]; 82 [sself cancel];
82 83
83 - [[UIApplication sharedApplication] endBackgroundTask:sself.backgroundTaskId]; 84 + [app endBackgroundTask:sself.backgroundTaskId];
84 sself.backgroundTaskId = UIBackgroundTaskInvalid; 85 sself.backgroundTaskId = UIBackgroundTaskInvalid;
85 } 86 }
86 }]; 87 }];
@@ -129,7 +130,8 @@ @@ -129,7 +130,8 @@
129 return; 130 return;
130 } 131 }
131 if (self.backgroundTaskId != UIBackgroundTaskInvalid) { 132 if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
132 - [[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskId]; 133 + UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)];
  134 + [app endBackgroundTask:self.backgroundTaskId];
133 self.backgroundTaskId = UIBackgroundTaskInvalid; 135 self.backgroundTaskId = UIBackgroundTaskInvalid;
134 } 136 }
135 #endif 137 #endif