Skip to content

Commit

Permalink
Get version from [NSProcessInfo processInfo].operatingSystemVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard committed Oct 5, 2023
1 parent 8feca43 commit e91b7fd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions GoogleUtilities/Environment/GULAppEnvironmentUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#import "third_party/IsAppEncrypted/Public/IsAppEncrypted.h"

#if TARGET_OS_IOS || (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
#if TARGET_OS_IOS
#import <UIKit/UIKit.h>
#endif

Expand Down Expand Up @@ -167,7 +167,9 @@ + (NSString *)deviceSimulatorModel {
model = @"watchOS Simulator";
#elif TARGET_OS_TV
model = @"tvOS Simulator";
#elif TARGET_OS_IPHONE
#elif defined(TARGET_OS_VISION) && TARGET_OS_VISION
model = @"visionOS Simulator";
#elif TARGET_OS_IOS
switch ([[UIDevice currentDevice] userInterfaceIdiom]) {
case UIUserInterfaceIdiomPhone:
model = @"iOS Simulator (iPhone)";
Expand All @@ -191,9 +193,10 @@ + (NSString *)deviceSimulatorModel {
}

+ (NSString *)systemVersion {
#if TARGET_OS_IOS || TARGET_OS_VISION
#if TARGET_OS_IOS
return [UIDevice currentDevice].systemVersion;
#elif TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_WATCH
#elif TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_WATCH || \
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
// Assemble the systemVersion, excluding the patch version if it's 0.
NSOperatingSystemVersion osVersion = [NSProcessInfo processInfo].operatingSystemVersion;
NSMutableString *versionString = [[NSMutableString alloc]
Expand Down

0 comments on commit e91b7fd

Please sign in to comment.