Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GoogleUtilities/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 7.1.0 -- Unreleased
- Added `NSURLSession` promise extension. (#6753)
- `ios_on_mac` option added to `GULAppEnvironmentUtil.applePlatform()`. (#6799)

# 7.0.0
- All APIs are now public. All CocoaPods private headers are transitioned to public. Note that
Expand Down
12 changes: 11 additions & 1 deletion GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,24 @@ + (NSString *)applePlatform {
#if TARGET_OS_MACCATALYST
applePlatform = @"maccatalyst";
#elif TARGET_OS_IOS

#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
if (@available(iOS 14.0, *)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add Catalyst at the same time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking into account how ugly are the availability checks I would prefer to keep using #if TARGET_OS_MACCATALYST that works just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to use the runtime check for iOS on mac because at compile time it is still iOS.

applePlatform = [NSProcessInfo processInfo].isiOSAppOnMac ? @"ios_on_mac" : @"ios";
} else {
applePlatform = @"ios";
}
#else // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
applePlatform = @"ios";
#endif // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000

#elif TARGET_OS_TV
applePlatform = @"tvos";
#elif TARGET_OS_OSX
applePlatform = @"macos";
#elif TARGET_OS_WATCH
applePlatform = @"watchos";
#endif
#endif // TARGET_OS_MACCATALYST

return applePlatform;
}
Expand Down