This commit implements the BuildInfo Capacitor plugin for iOS to retrieve the app version and build number from Info.plist. This resolves an issue where the version information was not being updated on iOS devices due to the absence of a native plugin implementation.
23 lines
792 B
Swift
23 lines
792 B
Swift
|
|
import Foundation
|
|
import Capacitor
|
|
|
|
@objc(BuildInfoPlugin)
|
|
public class BuildInfoPlugin: CAPPlugin {
|
|
@objc func getBuildInfo(_ call: CAPPluginCall) {
|
|
let versionName = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0"
|
|
let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1"
|
|
|
|
let result = [
|
|
"versionName": versionName,
|
|
"buildNumber": Int(buildNumber) ?? 1,
|
|
"platform": "ios",
|
|
// 추가 디버깅 정보
|
|
"bundleId": Bundle.main.bundleIdentifier ?? "unknown",
|
|
"buildDate": DateFormatter.localizedString(from: Date(), dateStyle: .short, timeStyle: .short)
|
|
] as [String : Any]
|
|
|
|
call.resolve(result)
|
|
}
|
|
}
|