[iOS] Alamofire 安裝

如果沒有 CocoPods 請先安裝

STEP1.在Xcode開一個project  然後 關掉Xcode

STEP2. 利用 terminal cd 到剛剛的project 資料夾

STPE3. terminal 下指令" pod init"

STEP4. project 資料夾內會多出Podfile ,編輯Podfile

STEP5. Podfile裡面填入
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'ProjectName' do
pod 'Alamofire', '~> 3.4'
end
view raw gistfile1.txt hosted with ❤ by GitHub

ProjectName 就是你Xcode project的名稱


STEP6. terminal 下指令" pod install"

STEP7. 最後在project 內記得要 import Alamofire


如果出現

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.


在info.plist 按右鍵 -> open as source code 加入下面
NSAppTransportSecurity
   
        NSAllowsArbitraryLoads
       
    

沒有留言:

張貼留言

蔡松霖
Related Posts with Thumbnails