Skip to content

Commit

Permalink
Merge pull request #523 from qonversion/catalystPlatformFix
Browse files Browse the repository at this point in the history
Catalyst platform fix
  • Loading branch information
suriksarkisyan authored Jul 4, 2024
2 parents e8f855d + 40f2fa5 commit d2b03d0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,22 @@ + (NSString*)getVendorID:(int) maxAttempts {
}

+ (NSString*)getPlatformString {
#if TARGET_OS_MACCATALYST
io_service_t service = IOServiceGetMatchingService(kIOMainPortDefault,
IOServiceMatching("IOPlatformExpertDevice"));
CFStringRef model = IORegistryEntryCreateCFProperty(service,
CFSTR("model"),
kCFAllocatorDefault,
0);

NSString *modelIdentifier = [[NSString alloc] initWithData:(__bridge NSData *)model
encoding:NSUTF8StringEncoding];

CFRelease(model);
IOObjectRelease(service);

return modelIdentifier;
#else
#if UI_DEVICE
const char *sysctl_name = "hw.machine";
#else
Expand All @@ -335,6 +351,7 @@ + (NSString*)getPlatformString {
NSString *platform = [NSString stringWithUTF8String:machine];
free(machine);
return platform;
#endif
}

+ (NSString*)getDeviceModel {
Expand Down

0 comments on commit d2b03d0

Please sign in to comment.