iOS 下 Podfile 使用方法

來源:互聯網
上載者:User

標籤: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 使用方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.