iOS/CI&CD

[iOS] Fastlane CI/CD 구축 시 발생 오류 및 해결법

홍루피 2025. 3. 14. 22:18

거창하게 오류 해결법인데 사실 자잘한 버그..(지만 계속 실행 실패하고 눈물 흘린 것들)을 정리하고자 함.

 

이전글 

[iOS] Fastlane + Github Action으로 CI/CD 구축하기(1) - Fastlane을 통한 TestFlight 업로드
[iOS] Fastlane + Github Action으로 CI/CD 구축하기(2) - Fastlane Match를 활용한 인증서 관리 및 Github Action 연동

 

1. 빌드 시 타임아웃 오류 

/opt/homebrew/lib/ruby/gems/3.3.0/gems/fastlane-2.226.0/fastlane_core/lib/fastlane_core/project.rb:437:in `rescue in build_settings': [!] xcodebuild -showBuildSettings timed out after 4 retries with a base timeout of 3. You can override the base timeout value with the environment variable FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT, and the number of retries with the environment variable FASTLANE_XCODEBUILD_SETTINGS_RETRIES  (FastlaneCore::Interface::FastlaneDependencyCausedException)

 

Fastfile 상의 환경변수로 타임아웃 시간을 증가시킴

# Fastfile을 아래와 같이 수정

platform :ios do
  desc "Push a new beta build to TestFlight"

  before_all do
    ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "600"
  end

 

2. Git clone "{ 인증서 Repository }"에서 멈춰있는 오류

SSH 설정이 잘못 되어있는 경우 멈춰서 더 이상 진행이 안될 수 있음

아래 명령어로 다시 값을 확인해보고 Git secrets에 정상적으로 설정했는지 확인하기

(+ pbcopy해서 나온 값 건들지 않았는지 확인..)

(+ Github 계정 SSH설정이랑 헷갈리면 안됨)

Kown host값
ssh-keyscan github.com | pbcopy -

키 생성
ssh-keygen

개인키 > 프로젝트 레포 Secret 설정
pbcopy < {KEY_FILE_NAME} 

공개키 > 인증서 레포 Deploy Key 설정
pbcopy < {KEY_FILE_NAME}.pub

 

3. error: Unable to find a device matching the provided destination specifier

359INFO [2025-03-07 08:32:40.17]: ▸ { platform:iOS Simulator, OS:18.2, name:iPhone 16 }

360INFO [2025-03-07 08:32:40.17]: ▸ The requested device could not be found because no available devices matched the request.

361INFO [2025-03-07 08:32:40.17]: ▸ Ineligible destinations for the "Rebit" scheme:

362INFO [2025-03-07 08:32:40.17]: ▸ { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 18.2 is not installed. To use with Xcode, first download and install the platform }

 

위의 오류는 간헐적으로 나타나는데, 가상환경 상에서 시뮬레이터를 찾지 못했다는 오류임.

아래와 같이 설정해주면 빌드가 되긴 한다.

https://github.com/fastlane/fastlane/issues/22233

이슈사항에서도 지속적으로 언급되고 있는데 원인은 모르겠음..더 나은 방법을 아시는 분은 저에게 꼭 알려주세용..

  lane :test do
    scan(
      project: "Rebit.xcodeproj",
      devices: ["iPhone 16 Pro"]
    )
  end
  
   lane :beta do
     build_ios_app(
      scheme: "Rebit",
      destination: "platform=iOS Simulator,name=iPhone 16 Pro"
    )
  end