標籤:ati hang install ini code space asc ast 1.0
配置 Podlist
Pod 是 iOS 下包管理工具,類似於 JavaScript 裡的 npm 或 yarn。
建立 Podfile
建立 Podfile 有兩種方式:
- 開啟 Terminal,在 iOS 項目的根目錄,執行
touch Podfile
或者
- 開啟 Terminal,在 iOS 項目的根目錄,執行
pod init
配置 Podfile
一個簡單的 Podfile
target ‘MyApp‘pod ‘AFNetworking‘, ‘~>3.0.4‘ # AFNetworking 版本必須 >=3.0.4 並且 <3.1.0
一個複雜的 Podfile
platform :ios, ‘9.0‘ # 指定平台與版本inhibit_all_warnings! # 全域禁止顯示警告target ‘MyApp‘ do# Pods for MyApppod ‘Fabric‘, ‘~>1.6.0‘ # Fabric 版本必須 >=1.6.0 並且 <1.7.0pod ‘ObjectiveSugar‘, ‘>=1.0.0‘ # ObjectiveSugar 版本必須 >=1.0.0pod ‘AFNetworking‘,‘<=4.0‘ # AFNetworking 版本必須<=4.0 # Pods for testing target ‘MyAppTests‘ do # MyAppTests 目錄下的引用 inherit! :search_paths end # Pods for testing target ‘MyAppUITests‘ do # MyAppUITests 目錄下的引用 inherit! :search_paths endend
安裝依賴包
註:要先關閉 xcode, 不然不能正常產生 Podfile.lock 和 xxx.xcworkspace 檔案
開啟 Terminal,在 iOS 項目的根目錄,執行 pod install
參考文檔
- http://www.jianshu.com/p/8af475c4f717
- http://www.devzhang.com/14557860422170.html
歡迎您幫忙錯誤修正, 一起協助更多的人。 一起來學習交流React, QQ群:413381701
首發於:https://github.com/Kennytian/learning-react-native
iOS 下 Podfile 使用方法