Skip to content

Commit 79d3ed6

Browse files
committed
- Fix deprecation warnings
1 parent f80cbe2 commit 79d3ed6

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

mParticle-Apple-SDK-Swift/Sources/Utils/MPDevice.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,19 @@ public class MPDevice: NSObject, NSCopying {
110110
get {
111111
if let arch = _architecture {
112112
return arch
113-
} else {
114-
guard let archRaw = NXGetLocalArchInfo().pointee.name else {
115-
return "unknown"
113+
}
114+
115+
var systemInfo = utsname()
116+
uname(&systemInfo)
117+
118+
let arch = withUnsafePointer(to: &systemInfo.machine) {
119+
$0.withMemoryRebound(to: CChar.self, capacity: 1) {
120+
String(cString: $0)
116121
}
117-
return String(cString: archRaw)
118122
}
123+
124+
_architecture = arch
125+
return arch
119126
}
120127
set {
121128
_architecture = newValue
@@ -127,7 +134,7 @@ public class MPDevice: NSObject, NSCopying {
127134
}
128135

129136
@objc public var country: String? {
130-
return Locale.current.regionCode
137+
return Locale.current.region?.identifier
131138
}
132139

133140
private var _deviceIdentifier: String?

0 commit comments

Comments
 (0)