산나물의 코드정원

시뮬레이터 빌드시 "[!] CocoaPods could not find compatible versions for pod 'Firebase/CoreOnly' " 에러 본문

CODE/Error

시뮬레이터 빌드시 "[!] CocoaPods could not find compatible versions for pod 'Firebase/CoreOnly' " 에러

heesanee 2024. 3. 22. 11:16

프로젝트에 앱 푸시 알림 기능을 추가하고 iOS 시뮬레이터를 실행을 하였는데 다음과 같은 오류가 발생했다.

[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
In snapshot (Podfile.lock):
Firebase/CoreOnly (= 10.3.0)

In Podfile:
firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 2.9.0, which depends on
  Firebase/CoreOnly (= 10.7.0)

Specs satisfying the `Firebase/CoreOnly (= 10.3.0), Firebase/CoreOnly (= 10.7.0)` dependency were found, but they required a higher minimum deployment target.

[!] Automatically assigning platform `iOS` with version `13.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

 

이젠 오류가 나지 않고 순조롭게 진행되는 게 더 무서울 지경이다. 분명 FCM을 도입할 때 Firebase 공식문서의 방법대로 다음과 같이 세팅을 해주었었다.

  • ios 폴더 안에 있는 Podfile에 Firebase SDK를 추가
  • AppDelegate.swift 파일에 Firebase 초기화 코드 추가

(코드의 내용은 FCM 공식문서에 나와있으니 생략하겠습니다.)

 

오류의 내용을 직역하자면 'CocoaPods가 'Firebase/CoreOnly'의 호환 가능한 버전을 찾을 수 없다'라고 이야기하고 있다.

그래서 혹시나 pubspec.yaml 파일을 확인해 보았다.(Node.js의 package.json과 같은 패키지 의존성 관리 및 프로젝트 정의 등의 역할을 갖습니다.)

# [pubspec.yaml]
# firebase library
firebase_core: ^2.25.4
firebase_messaging: ^14.7.15

 

FCM에 필요한 패키지는 모두 설치가 되어 있는 것 같고... 어디가 문제일까?

일단 뭐든 잘 안될 때 항상 처음 시도해 보는 그것을 해보자!

flutter clean
flutter build ios

pod install
pod update
pod repo update
pod install --repo-update

하지만 여전히 같은 오류 메시지... 다른 블로그 자료를 좀 더 찾아보고 챗 GPT4에게도 여러 가지를 물어봤더니 Podfile.lock 파일을 다시 삭제하고 다시 시도해 보라는 것이었다.

그리고 M1 칩을 사용하는 맥북의 경우 'pod install --repo-update' 명령어 대신 'arch -x86_64 pod install --repo-update'을 사용해 보라고 했다.

다음과 같이 재시도를 해보았다.

cd ios
rm -rf Podfile.lock
pod install
arch -x86_64 pod install --repo-update

 

드디어 시뮬레이터가 정상적으로 잘 작동하였다. 역시 같은 문제에 직면한 분들이 여러 있다. 잘 찾아보면 해결할 수 있다!

포기하지 말고 좌절하지 말자! 이 글도 누군가에겐 도움이 되었으면 한다.

읽어주셔서 감사합니다!