๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

iOS/3rd Party Library

[iOS] CocoaPods - ๋ช…๋ น์–ด ๋ฐ ์—๋Ÿฌ ์ •๋ฆฌ

๐Ÿ”‘ ์ฝ”์ฝ”์•„ํŒŸ ๋ช…๋ น์–ด


# ์ž‘์„ฑํ•œ Podfile์„ ํ†ตํ•ด pod์„ ์„ค์ •(์ถ”๊ฐ€,์ˆ˜์ •,์‚ญ์ œ)ํ•ด์ฃผ๋Š” ๋ช…๋ น์–ด
$ pod install
  • ํ•ด๋‹น ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•œ ํ›„ .xcworkspace ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ํŒŒ์ผ์€ .xcodeproj์˜ ๋ชจ์Œ์ž…๋‹ˆ๋‹ค.
    • Xcode ํ”„๋กœ์ ํŠธ๋ฅผ ์›Œํฌ์ŠคํŽ˜์ด์Šค๋ผ๋Š” ํ•˜๋‚˜์˜ ์ž‘์—…๊ณต๊ฐ„์œผ๋กœ ๋ฌถ์–ด๋†“์€ ๋‹จ์œ„์ž…๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ Xcode ํ”„๋กœ์ ํŠธ์˜ ์˜์กด์„ฑ์„ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ฝ”์ฝ”์•„ํŒŸ์„ ํ†ตํ•ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๊ฐ€์ ธ์˜ค๋ฉด ๊ธฐ์กด ํ”„๋กœ์ ํŠธ์™€ ์˜์กด์„ฑ์„ ๋งบ์–ด์ฃผ๊ธฐ ์œ„ํ•ด ์›Œํฌ์ŠคํŽ˜์ด์Šค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ฒ˜์Œ์— ์ƒ์„ฑํ•œ ํ”„๋กœ์ ํŠธ์™€ ๋ฐ›์•„์˜จ Pod๋“ค์„ ๋ฌถ์–ด์„œ ํ•˜๋‚˜์˜ ์›Œํฌ์ŠคํŽ˜์ด์Šค๋กœ ๊ตฌ์„ฑํ•˜์—ฌ ๊ธฐ์กด ํ”„๋กœ์ ํŠธ ์ด๋ฆ„๊ณผ ๋™์ผํ•œ ์ด๋ฆ„์˜ ์›Œํฌ์ŠคํŽ˜์ด์Šค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

 

# ํŒŸ์˜ ์—…๋ฐ์ดํŠธ๋œ ๋ฒ„์ „์„ ํ™•์ธํ•œ ํ›„ ์ตœ์‹ ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธ (Podfile.lock ์ฐธ์กฐํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.)
$ pod update

# ๋ชจ๋“ˆ ํ•˜๋‚˜์—๋งŒ ์ ์šฉํ•  ๊ฒฝ์šฐ, pod update [๋ชจ๋“ˆ๋ช…] —no-repo-update
$ pod update {ํŒŸ์ด๋ฆ„} -> ๊ฐœ๋ณ„์ ์ธ pod์— ๋Œ€ํ•œ ์—…๋ฐ์ดํŠธ๋„ ๊ฐ€๋Šฅ
# Podfile.lock์— ์ž‘์„ฑ๋˜์–ด์žˆ๋Š” ๋ฒ„์ „๋ณด๋‹ค ์ƒˆ๋กœ์šด ๋ฒ„์ „์„ ๊ฐ€์ง„ ํŒŸ์„ ๋‚˜์—ดํ•ด์ฃผ๋Š” ๋ช…๋ น์–ด
$ pod outdated
# /Users/{์‚ฌ์šฉ์ž์ด๋ฆ„}/.cocoapods/repos ๊ฒฝ๋กœ์— ์žˆ๋Š” ๋ชจ๋“  podspec ํŒŒ์ผ์„ ์—…๋ฐ์ดํŠธ ํ•ฉ๋‹ˆ๋‹ค.
$ pod repo update

# ๊ฐœ๋ณ„์ ์ธ pod์— ๋Œ€ํ•œ ์—…๋ฐ์ดํŠธ๋„ ๊ฐ€๋Šฅ
$ pod repo update {ํŒŸ์ด๋ฆ„}

 

# ๊ธฐ์กด์— ํŒŸ๋“ค ์ข…์†์„ฑ ์ œ๊ฑฐ
$ pod deintegrate

 

๐Ÿšจ ์ฝ”์ฝ”์•„ํŒŸ ์—๋Ÿฌ


1. ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES ์—๋Ÿฌ

[!] The `ํ”„๋กœ์ ํŠธ๋ช… [๋นŒ๋“œconfiguration๋ช…]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-PAPA/Pods-PAPA.stage.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

  • Build Settings → Build Options ์˜ Always Embed Swift Libraries๋ฅผ $(inherited)๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.

 

2. CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER ์—๋Ÿฌ

[!] The `ํ”„๋กœ์ ํŠธ๋ช… [๋นŒ๋“œconfiguration๋ช…]` target overrides the `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` build setting defined in `Pods/Target Support Files/Pods-CommonData/Pods-CommonData.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

 

  • Build Settings → Build Options ์˜ Quoted Include In Framework Header๋ฅผ $(inherited)๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.

 

3. ์ฝ”์ฝ”์•„ํŒŸ์ด๋‚˜ ์„œ๋“œํŒŒํ‹ฐ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ๋ฒ„์ „๋ช…์‹œ๋Š” ๋งค์šฐ ์ค‘์š”

  • ๋ฒ„์ „์ด ๋ณ€๊ฒฝ๋จ์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํ˜‘์—…์„ ํ•˜๋Š” ๊ฒฝ์šฐ ๊ผญ ๋ฒ„์ „๋ช…์‹œ๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

 

4. ์ฝ”์ฝ”์•„ํŒŸ ์‚ญ์ œ ํ›„ ์žฌ์„ค์น˜

$ sudo gem install cocoapods-deintegrate cocoapods-clean

$ pod deintegrate 

$ pod clean

$ rm Podfile

 

5. CocoaPod Refresh

$ pod cache clean --all
$ pod deintegrate
$ rm Podfile.lock

 

6. FireStore ๋นŒ๋“œ์‹œ๊ฐ„ ๊ธฐํ•˜๊ธ‰์ˆ˜์ ์œผ๋กœ ์ฆ๊ฐ€๋œ ์ด์Šˆ

pod 'FirebaseFirestore', :git => '<https://github.com/invertase/firestore-ios-sdk-frameworks.git>', :tag => '10.19.0'

 

์ฐธ์กฐ : CocoaPods binary cache (์ฝ”์ฝ”์•„ํŒŸ ์‚ฌ์šฉ์‹œ Xcode๋นŒ๋“œ์‹œ๊ฐ„ ๋‹จ์ถ•์‹œํ‚ค๊ธฐ)

๊ฐ„๋‹จํžˆ Xcode์—์„œ ์ปดํŒŒ์ผํ•˜๊ธฐ ์ „์ธ pod install ์‹œ์ ์— ์‚ฌ์ „์ปดํŒŒ์ผ์„ ์ง„ํ–‰ํ•˜์—ฌ Xcode ๋นŒ๋“œ์‹œ๊ฐ„์„ ๋‹จ์ถ•์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

  1. ์‚ฌ์šฉ์ž๊ฐ€ ์ง€์ •ํ•œ pod์— ๋Œ€ํ•ด ์‚ฌ์ „ ๋นŒ๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•ด ๋ฐ”์ด๋„ˆ๋ฆฌ ํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ , ์ด๋ฅผ Pods ํ”„๋กœ์ ํŠธ์— ์—ฐ๊ฒฐํ•˜๋Š” ์‹์œผ๋กœ pods ๋นŒ๋“œ ์‹œ๊ฐ„์„ ์—†์• ์ค๋‹ˆ๋‹ค.
  2. ์‚ฌ์ „ ๋นŒ๋“œ๋œ ๋ฐ”์ด๋„ˆ๋ฆฌ ํŒŒ์ผ ๋“ฑ์„ Git ์ €์žฅ์†Œ์˜ ํ˜•ํƒœ๋กœ ์ œ๊ณตํ•ด ๋กœ์ปฌ, ์›๊ฒฉ ๊ฒฝ๋กœ๋ฅผ ํ†ตํ•ด(๋ณ„๋„ ์ง€์ • ๊ฐ€๋Šฅ) ๋งค๋ฒˆ ๋”ฐ๋กœ ๋นŒ๋“œํ•  ํ•„์š”์—†์ด ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๋นŒ๋“œ๋œ ํŒŒ์ผ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

 

7. Sandbox: rsync.samba ์ด์Šˆ

Xcode 15๋ถ€ํ„ฐ Pod์„ ์ถ”๊ฐ€ํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๋ฅผ ๋นŒ๋“œํ•˜๋Š” ๊ฒฝ์šฐ ๊ถŒํ•œ ๋ฌธ์ œ๋กœ ์ธํ•ด Sandbox ์ ‘๊ทผ ๊ฑฐ๋ถ€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
User Script Sandboxing์„ No๋กœ ์„ค์ •ํ•˜๋ฉด ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•ด๊ฒฐ๋ฉ๋‹ˆ๋‹ค.
 

8. ๊ตฌ๊ธ€๋กœ๊ทธ์ธ Pod ์„ค์น˜ ์ด์Šˆ

Firebase ์ œํ’ˆ๋“ค๊ณผ ์—ฐ๊ฒฐ๋˜์–ด์žˆ์–ด์„œ GoogleUtilites๋„ ๊ฐ๊ฐ ๋‹ค๋ฅด๊ฒŒ ์„ค์น˜๋  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
 

๐Ÿง [CP] Copy Pods Resources ์‚ญ์ œ ๋˜์—ˆ๋‹ค??

[CP] Copy Pods Resources ์Šคํฌ๋ฆฝํŠธ์˜ ๋ชฉ์ ์€ CocoaPod์—์„œ ์ž๋™์ƒ์„ฑ๋˜๋Š” ์Šคํฌ๋ฆฝํŠธ์ธ๋ฐ ์ถ”๊ฐ€ํ•œ Pod์—์„œ Resource(์ด๋ฏธ์ง€, ํฐํŠธ ๋“ฑ๋“ฑ)์žˆ๋Š” ๊ฒฝ์šฐ ์ƒ์„ฑ๋˜๋Š” ์Šคํฌ๋ฆฝํŠธ์ž…๋‹ˆ๋‹ค.  
Firebase, ๋˜๋Š” ๊ตฌ๊ธ€๋กœ๊ทธ์ธ ํŒŸ๋“ค ์ค‘์—์„œ Resource๊ฐ€ ์—†์–ด์กŒ๊ธฐ ๋•Œ๋ฌธ์— ์‚ญ์ œ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
Firebase ์ œํ’ˆ๋“ค๊ณผ ๊ตฌ๊ธ€๋กœ๊ทธ์ธ ํŒŸ๋ฒ„์ „์„ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜๋Š” ๊ฒฝ์šฐ Xcode → Build Phases์— pod install์‹œ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” [CP] Copy Pods Resources๊ฐ€ ์ถ”๊ฐ€๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
 

9. CocoaPod์˜ Spec๊ณผ Github์˜ Releases Tag๋ฒ„์ „์ด ๋‹ค๋ฅธ ๊ฒฝ์šฐ

๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ณ„ Github ์ €์žฅ์†Œ์˜ Releaseํƒœ๊ทธ๋ฒ„์ „์„ ํ™•์ธ ํ•œ ํ›„ pod์„ ์„ค์น˜ํ•˜์—ฌ๋„ ๐Ÿ”— CocoaPods Spec์— ์—†๋‹ค๋ฉด ์„ค์น˜๊ฐ€ ์•ˆ๋˜๋ฏ€๋กœ ๐Ÿ”— CocoaPods Spec๊ธฐ์ค€์œผ๋กœ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
 

๐Ÿ”— ์ฐธ๊ณ ๋งํฌ