๋ฐ์ํ
infoDictionary๋
- ํค ๊ฐ์ผ๋ก ๊ฐ์ ์ ๊ทผ ํ ์ ์๋ ๋์ ๋๋ฆฌ ํ์
- ํ๊ฒ > Info ํญ์ ์๋ Info.plist ํ์ผ๋ก ๋ถํฐ ์์ฑ๋์ด ํด๋น ๊ฐ์ ์ ๊ทผ ํ ์ ์์
- infoDictionary์ ํค๊ฐ์ Info.plist์ Raw Keys ์ผ๋ก ์ค์ ํด์ ํ์ธํ ์ ์์
- ์ฃผ๋ก CFBundleIdentifier, NSMainNibFile, NSPrincipalClass ํค ๊ฐ์ด ์ฌ์ฉ๋จ
์ฑ ๋ฒ์ ํ์ธ
/// App Version
public func getCurrentAppVersion() -> String? {
guard let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else {
return nil
}
return appVersion
}
- General ํญ > Identity ์น์ > Version์์ ์ ๋ณด๋ฅผ ๋ฐ๊พธ๋ฉด Build Settings์ Versioning ์น์ ์ Marketing Version์ด ๋ณ๊ฒฝ๋๋ ๊ฒ์ ํ์ธํ ์ ์์
- ์ด๋ ์ด Marketing Version์ CFBundleShortVersionString ํค ๊ฐ์ผ๋ก ์ป์ ์ ์์
์ฑ ๋ฒ๋ค ์์ด๋ ํ์ธ
/// App Bundle ID
public func getBundleID() -> String? {
guard let identifier = Bundle.main.infoDictionary?["CFBundleIdentifier"] as? String else {
return nil
}
return identifier
}
- ํ๊ฒ์ ๋ ๊ฐ ๋ง๋ค์ด ์ฃผ๊ณ ๊ฐ๊ฐ Bundle Identifier ๊ฐ์ ๋ณ๊ฒฝ
- ๊ฐ ํ๊ฒ์ ์ ๋ณด๊ฐ ์ถ๋ ฅ๋จ. ํ๋ก์ ํธ์ ์ค์ ์ด ์๋ ํ๊ฒ์ ์ค์ ์ธ Info.plist์ ์ ๋ณด๋ฅผ ๋ฐ๋ผ๊ฐ๋ ๊ฒ์ ํ์ธํ ์ ์์
์ฝ๋ํ์ธ ํ ์ ์๋ ๊นํ๋ธ ์ฃผ์ : https://github.com/youabledev/archive/blob/main/Archive/Basic%20Setting/TargetInfo.swift
์ฐธ๊ณ ์ฌ์ดํธ ๋ฐ ๋์
728x90
๋ฐ์ํ
'๐ iOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[iOS/Swift] SafeArea ๋์ด ๊ตฌํ๊ธฐ (0) | 2023.02.05 |
---|---|
[iOS/Swift] UIDevice ๋ฒ์ , UUID, ๊ธฐ๊ธฐ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ (0) | 2023.02.04 |
[iOS/Swift] ์ฑ๊ธํค ๊ฐ์ฒด ์์ฑ Singleton (0) | 2023.02.04 |
[iOS/Swift] UIPresentationController (0) | 2023.01.29 |
[iOS/Swift] UIViewControllerTransitioningDelegate (0) | 2023.01.29 |
๋๊ธ