We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2478811 commit 728b656Copy full SHA for 728b656
lib/pal/posix/sysinfo_utils_ios.mm
@@ -5,6 +5,7 @@
5
6
#include "sysinfo_utils_apple.hpp"
7
#import <Foundation/Foundation.h>
8
+#import <sys/utsname.h>
9
#import <UIKit/UIKit.h>
10
11
std::string GetDeviceModel()
@@ -14,7 +15,18 @@
14
15
NSString* modelId = NSProcessInfo.processInfo.environment[@"SIMULATOR_MODEL_IDENTIFIER"];
16
return std::string([modelId UTF8String]);
17
#else
- std::string deviceModel { [[[UIDevice currentDevice] model] UTF8String] };
18
+ std::string deviceModel { };
19
+ struct utsname systemInfo;
20
+ if (uname(&systemInfo) < 0)
21
+ {
22
+ // Fallback to UIDevice in case of error
23
+ deviceModel = [[[UIDevice currentDevice] model] UTF8String];
24
+ }
25
+ else
26
27
+ deviceModel = systemInfo.machine;
28
29
+
30
return deviceModel;
31
#endif
32
}
0 commit comments