主要获取了APP应用程序名、以及版本号。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
let infoDict = Bundle.main.infoDictionary!;
let appDisplayName = infoDict["CFBundleDisplayName"];
let appShortVersion = infoDict["CFBundleShortVersionString"];
let appBuildVersion = infoDict["CFBundleVersion"];
let resolveDict = [
    "appDisplayName": appDisplayName,
    "appShortVersion": appShortVersion,
    "appBuildVersion": appBuildVersion,
]
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);
}