iOS 간단히 프로젝트에pod 추가

2482 단어
, 。 , Xcode CocoaPods , Xcode , , , , 。
1. 새 프로젝트 PodTest
2. 터미널을 열고 cd를 PodTest 루트로 이동
3. 터미널에서 "pod init"를 입력하면 Podfile이라는 파일이 자동으로 생성됩니다.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'PosTest' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for PosTest

  target 'PosTestTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'PosTestUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

4. Podfile 파일 편집
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'PosTest' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for PosTest

  pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'

  target 'PosTestTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'PosTestUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

5. 터미널에서 "pod install"을 입력하고 다운로드가 완료될 때까지 기다립니다.
pod install

6. 프로젝트 디렉토리로 돌아가서 PosTest.xcworkspace 를 두 번 클릭하여 프로그램에 들어갑니다
다음은 전체 터미널에서 입력한 코드입니다.
WinsondeMacBook-Pro:~ Winson_microlink$ cd /Users/Winson_microlink/Documents/Xcode\ Projects/PosTest 
WinsondeMacBook-Pro:PosTest Winson_microlink$ pod init
WinsondeMacBook-Pro:PosTest Winson_microlink$ pod install
Analyzing dependencies
Pre-downloading: `SVProgressHUD` from `https://github.com/SVProgressHUD/SVProgressHUD.git`
Downloading dependencies
Installing SVProgressHUD (2.2.2)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `PosTest.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] Automatically assigning platform ios with version 11.0 on target PosTest because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
WinsondeMacBook-Pro:PosTest Winson_microlink$

좋은 웹페이지 즐겨찾기