From 855a7665aef505db456aa1c6f1cb9ea2b68056da Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Fri, 13 Jul 2018 09:57:32 -0700 Subject: Restore iOS7 to GoogleUtilities (#1528) --- GoogleUtilities.podspec | 2 +- GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m | 9 ++++++++- .../Example/Tests/Environment/GULAppEnvironmentUtilTest.m | 4 ++++ GoogleUtilities/Network/GULNetworkURLSession.m | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/GoogleUtilities.podspec b/GoogleUtilities.podspec index 43833f2..957591c 100644 --- a/GoogleUtilities.podspec +++ b/GoogleUtilities.podspec @@ -19,7 +19,7 @@ other Google CocoaPods. They're not intended for direct public usage. # :tag => 'Utilities-' + s.version.to_s :tag => 'pre-5.3-' + s.version.to_s } - s.ios.deployment_target = '6.0' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.10' s.tvos.deployment_target = '10.0' diff --git a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m index e96ba70..a1a63a2 100644 --- a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m +++ b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m @@ -19,6 +19,10 @@ #import #import +#if TARGET_OS_IOS +#import +#endif + /// The encryption info struct and constants are missing from the iPhoneSimulator SDK, but not from /// the iPhoneOS or Mac OS X SDKs. Since one doesn't ever ship a Simulator binary, we'll just /// provide the definitions here. @@ -212,6 +216,9 @@ static BOOL HasEmbeddedMobileProvision() { } + (NSString *)systemVersion { +#if TARGET_OS_IOS + return [UIDevice currentDevice].systemVersion; +#elif TARGET_OS_OSX || TARGET_OS_TV // Assemble the systemVersion, excluding the patch version if it's 0. NSOperatingSystemVersion osVersion = [NSProcessInfo processInfo].operatingSystemVersion; NSMutableString *versionString = [[NSMutableString alloc] @@ -219,8 +226,8 @@ static BOOL HasEmbeddedMobileProvision() { if (osVersion.patchVersion != 0) { [versionString appendFormat:@".%ld", (long)osVersion.patchVersion]; } - return versionString; +#endif } + (BOOL)isAppExtension { diff --git a/GoogleUtilities/Example/Tests/Environment/GULAppEnvironmentUtilTest.m b/GoogleUtilities/Example/Tests/Environment/GULAppEnvironmentUtilTest.m index 62a7bf8..dc8923b 100644 --- a/GoogleUtilities/Example/Tests/Environment/GULAppEnvironmentUtilTest.m +++ b/GoogleUtilities/Example/Tests/Environment/GULAppEnvironmentUtilTest.m @@ -38,6 +38,9 @@ [_processInfoMock stopMocking]; } +// Remove the #if when iOS can remove iOS 7 support and also use processInfo instead of UIKit. +#if TARGET_OS_OSX || TARGET_OS_TV + - (void)testSystemVersionInfoMajorOnly { NSOperatingSystemVersion osTen = {.majorVersion = 10, .minorVersion = 0, .patchVersion = 0}; OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTen); @@ -58,5 +61,6 @@ XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]); } +#endif @end diff --git a/GoogleUtilities/Network/GULNetworkURLSession.m b/GoogleUtilities/Network/GULNetworkURLSession.m index cb8a204..71409bc 100644 --- a/GoogleUtilities/Network/GULNetworkURLSession.m +++ b/GoogleUtilities/Network/GULNetworkURLSession.m @@ -445,7 +445,10 @@ if ([NSURLSessionConfiguration respondsToSelector:@selector(backgroundSessionConfigurationWithIdentifier:)]) { // Running on iOS 8+/OS X 10.10+. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" return [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:sessionID]; +#pragma clang diagnostic pop } else { // Running on iOS 7/OS X 10.9. return [NSURLSessionConfiguration backgroundSessionConfiguration:sessionID]; -- cgit v1.2.3