Skip to content

Commit 43b6be4

Browse files
committed
Fixing device variant detection for M1 catalyst and sims
We previously were relying on the device architecture to determine the device variant, but that is no longer sufficient with the release of M1 macs.
1 parent b8728ce commit 43b6be4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,12 @@ + (NSString*)getDeviceVariant {
474474
let systemInfoMachine = [self getSystemInfoMachine];
475475

476476
// x86_64 could mean an iOS Simulator or Catalyst app on macOS
477-
if ([systemInfoMachine isEqualToString:@"x86_64"]) {
478-
let systemName = UIDevice.currentDevice.systemName;
479-
if ([systemName isEqualToString:@"iOS"]) {
480-
let model = UIDevice.currentDevice.model;
481-
return [@"Simulator " stringByAppendingString:model];
482-
} else {
483-
return @"Mac";
484-
}
485-
}
486-
477+
#if TARGET_OS_MACCATALYST
478+
return @"Mac";
479+
#elif TARGET_OS_SIMULATOR
480+
let model = UIDevice.currentDevice.model;
481+
return [@"Simulator " stringByAppendingString:model];
482+
#endif
487483
return systemInfoMachine;
488484
}
489485

0 commit comments

Comments
 (0)