这是我做一个iOS版本运维App的时候写的代码,记录一下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
let resolveDict = [
"systemName": UIDevice.current.systemName,
"systemVersion": UIDevice.current.systemVersion,
"identifierForVendor": UIDevice.current.identifierForVendor?.description ?? "",
"model": UIDevice.current.model,
"localizedModel": UIDevice.current.localizedModel
]
do {
let json = try JSONSerialization.data(withJSONObject: resolveDict, options: []);
let jsonStr = String(data: json, encoding: .utf8);
resovler(jsonStr);
} catch {
rejecter("Get AppInfo error", error.localizedDescription, nil);
}
|