2023년 신상 호텔 리스트
최근에 오픈한 호텔을 찾는다면 살펴보세요

Swift - CocoaPods 설치

조회수: 270
iOS용 구글 지도를 설치해보겠습니다.
Maps SDK for iOS.
CocoaPods을 설치해야 합니다.
설치하려면 터미널에서 sudo gem install cocoapods를 실행하면 된다.
CocoaPods는 Xcode 프로젝트의 라이브러리 종속성을 관리합니다.
프로젝트의 종속성은 Podfile이라는 단일 텍스트 파일에 지정됩니다. CocoaPods는 라이브러리 간의 종속성을 해결하고 결과 소스 코드를 가져온 다음 Xcode 작업 공간에서 함께 연결하여 프로젝트를 빌드합니다.

궁극적인 목표는 보다 중앙 집중화된 생태계를 만들어 타사 오픈 소스 라이브러리의 검색 가능성과 참여를 개선하는 것입니다.

다음 단계는 Pods를 Xcode 프로젝트에 추가해야 합니다. Podfile을 만들고 종속 항목을 추가합니다.


Podfile에 내용을 추가했습니다.

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '13.0'

target 'YOUR_APPLICATION_TARGET_NAME_HERE' do
  pod 'GoogleMaps', '7.4.0'
end

 


그리고 프로젝터 폴더에서 pod install을 터미널에서 실행합니다.
에러가 났습니다.

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "GoogleMaps":
  In Podfile:
    GoogleMaps (= 7.4.0)

None of your spec sources contain a spec satisfying the dependency: `GoogleMaps (= 7.4.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.


버전을 제외하고 다시 실행합니다.

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '13.0'

target 'sangseektravelmap' do
  pod 'GoogleMaps'
end


이번에는 제대로 설치가 되었습니다.

(base) james@Jamess-MacBook-Air sangseektravelmap % pod install
Analyzing dependencies
Downloading dependencies
Installing GoogleMaps (7.2.0)
Generating Pods project
Integrating client project

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



Xcode 세션을 모두 닫고 `sangseektravelmap.xcworkspace`를 사용하라고 합니다.
sangseektravelmap.xcodeproj 말고.