본문 바로가기
iOS/iOS

fastlane/TestFlight

by 패쓰킴 2025. 4. 3.
728x90

App Store Connect에 TestFlight 올리기

1. Fastfile 수정

기존에 작성되어 있는 불필요한 액션은 지워주자

default_platform(:ios)

platform :ios do
  desc "Push a new beta build to TestFlight" # "원하는 설명"
  lane :beta do # 원하는 이름 do
    # increment_build_number(xcodeproj: "프로젝트명.xcodeproj") 옵션. 빌드 숫자를 올려줌
    build_app(workspace: "프로젝트명.xcworkspace", scheme: "프로젝트명")
    upload_to_testflight
  end
end

이렇게 작성해주고 저장

 

2. 실행

fastlane beta

🧨  ERROR

이때부터 에러가 무진장 생김...

구글링과 에러 내용 고대로 GPT에 물어봐가며 해결 방법을 찾아갔다.

1) 인증서 문제

[13:51:14]: fastlane detected a Gemfile in the current directory
[13:51:14]: However, it seems like you didn't use bundle exec
[13:51:14]: To launch fastlane faster, please use
[13:51:14]:
[13:51:14]: $ bundle exec fastlane beta
[13:51:14]:
[13:51:14]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[13:51:14]: It seems like you wanted to load some plugins, however they couldn't be loaded
[13:51:14]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/
[13:51:14]: ------------------------------
[13:51:14]: --- Step: default_platform ---
[13:51:14]: ------------------------------
[13:51:14]: Driving the lane 'ios beta' 🚀
[13:51:14]: -----------------------
[13:51:14]: --- Step: build_app ---
[13:51:14]: -----------------------
[13:51:14]: Resolving Swift Package Manager dependencies...
[13:51:14]: $ xcodebuild -resolvePackageDependencies -workspace TodayVideo.xcworkspace -scheme ****
[13:51:15]: ▸ Command line invocation:
[13:51:15]: ▸     /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ****.xcworkspace -scheme ****
[13:51:15]: ▸ User defaults from command line:
[13:51:15]: ▸     IDEPackageSupportUseBuiltinSCM = YES
[13:51:15]: ▸ resolved source packages:
[13:51:15]: $ xcodebuild -showBuildSettings -workspace ****.xcworkspace -scheme **** 2>&1

+------------------------------------------------------------------------------------------------+
|                                    Summary for gym 2.227.0                                     |
+--------------------------------------+---------------------------------------------------------+
| workspace                            | ****.xcworkspace                                  |
| scheme                               | ****                                              |
| clean                                | false                                                   |
| output_directory                     | .                                                       |
| output_name                          | ****                                              |
| silent                               | false                                                   |
| skip_package_ipa                     | false                                                   |
| skip_package_pkg                     | false                                                   |
| build_path                           | /Users/user/Library/Developer/Xcode/Archives/2025-04-03 |
| result_bundle                        | false                                                   |
| buildlog_path                        | ~/Library/Logs/gym                                      |
| destination                          | generic/platform=iOS                                    |
| xcodebuild_formatter                 | xcpretty                                                |
| build_timing_summary                 | false                                                   |
| skip_profile_detection               | false                                                   |
| xcodebuild_command                   | xcodebuild                                              |
| skip_package_dependencies_resolution | false                                                   |
| disable_package_automatic_updates    | false                                                   |
| use_system_scm                       | false                                                   |
| xcode_path                           | /Applications/Xcode.app                                 |
+--------------------------------------+---------------------------------------------------------+

[13:51:16]: $ set -o pipefail && xcodebuild -workspace ****.xcworkspace -scheme **** -destination 'generic/platform=iOS' -archivePath ****
[13:51:29]: ▸ Copying Pods-****
[13:51:33]: ▸ Compiling LaunchScreen.storyboard
[13:51:35]: ▸ Processing Info.plist
[13:51:35]: ▸ Linking TodayVideo
[13:51:35]: ▸ Running script '[CP] Embed Pods Frameworks'
[13:51:36]: ▸ Generating '****.app.dSYM'
[13:51:36]: ▸ Touching ****.app (in target '****' from project '****')
[13:51:36]: ▸ Archive Succeeded
[13:51:36]: Generated plist file with the following values:
[13:51:36]: ▸ -----------------------------------------
[13:51:36]: ▸ {
[13:51:36]: ▸   "method": "app-store"
[13:51:36]: ▸ }
[13:51:36]: ▸ -----------------------------------------
[13:51:36]: $ /usr/bin/xcrun /opt/homebrew/Cellar/fastlane/2.227.0/libexec/gems/fastlane-2.227.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist ****
+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/_l/z48tz7_d01n18swpgp7tqy0c0000gn/T/gym_config20250403-50555-j4jpcz.plist -archivePath ****
2025-04-03 13:51:36.931 xcodebuild[50811:4826965] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path ****
2025-04-03 13:51:36.967 xcodebuild[50811:4826965] [MT] IDEDistribution: Command line name "app-store" is deprecated. Use "app-store-connect" instead.
error: exportArchive No signing certificate "iOS Distribution" found

error: exportArchive No profiles for '****' were found

** EXPORT FAILED **
[13:51:58]: Exit status: 70

+-----------------------------------------+
|            Build environment            |
+---------------+-------------------------+
| xcode_path    | /Applications/Xcode.app |
| gym_version   | 2.227.0                 |
| export_method | app-store               |
| sdk           | iPhoneOS18.2.sdk        |
+---------------+-------------------------+

[13:51:58]: ▸ note: Disabling previews because SWIFT_VERSION is set ****
[13:51:58]: ▸ ** ARCHIVE SUCCEEDED **
[13:51:58]:
[13:51:58]: ⬆️  Check out the few lines of raw xcodebuild output above for potential hints on how to solve this error
[13:51:58]: 📋  For the complete and more detailed error log, check the full log at:
[13:51:58]: 📋  /Users/user/Library/Logs/gym/****.log
[13:51:58]:
[13:51:58]: Looks like fastlane ran into a build/archive error with your project
[13:51:58]: It's hard to tell what's causing the error, so we wrote some guides on how
[13:51:58]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[13:51:58]: Before submitting an issue on GitHub, please follow the guide above and make
[13:51:58]: sure your project is set up correctly.
[13:51:58]: fastlane uses xcodebuild commands to generate your binary, you can see the
[13:51:58]: the full commands printed out in yellow in the above log.
[13:51:58]: Make sure to inspect the output above, as usually you'll find more error information there
[13:51:58]:
[13:51:58]: Looks like no provisioning profile mapping was provided
[13:51:58]: Please check the complete output, in particular the very top
[13:51:58]: and see if you can find more information. You can also run fastlane
[13:51:58]: with the --verbose flag.
[13:51:58]: Alternatively you can provide the provisioning profile mapping manually
[13:51:58]: https://docs.fastlane.tools/codesigning/xcode-project/#xcode-9-and-up
+-----------------------------+
|        Lane Context         |
+------------------+----------+
| DEFAULT_PLATFORM | ios      |
| PLATFORM_NAME    | ios      |
| LANE_NAME        | ios beta |
+------------------+----------+
[13:51:58]: Called from Fastfile at line 21
[13:51:58]: 
[13:51:58]:     19:	  desc "Push a new beta build to TestFlight"
[13:51:58]:     20:	  lane :beta do
[13:51:58]:  => 21:	    build_app(
[13:51:58]:     22:	      workspace: "****.xcworkspace",
[13:51:58]:     23:	      scheme: "****"
[13:51:58]:

[13:51:58]: Error packaging up the application

+---------------------------------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 💥   | build_app        | 43          |
+------+------------------+-------------+

[13:51:58]: fastlane finished with errors

[!] Error packaging up the application

이렇게 기다란 에러가 뜬다.. ㄷㄷ

일단 나의 경우엔 Distribution 인증서가 없어서 생긴 에러여서

인증서 생성 및 등록 과정을 거쳐 에러를 해결

 

2) Apple ID 인증 실패

[14:13:43]: fastlane detected a Gemfile in the current directory
[14:13:43]: However, it seems like you didn't use bundle exec
[14:13:43]: To launch fastlane faster, please use
[14:13:43]:
[14:13:43]: $ bundle exec fastlane beta
[14:13:43]:
[14:13:43]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[14:13:43]: It seems like you wanted to load some plugins, however they couldn't be loaded
[14:13:43]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/
[14:13:43]: ------------------------------
[14:13:43]: --- Step: default_platform ---
[14:13:43]: ------------------------------
[14:13:43]: Driving the lane 'ios beta' 🚀
[14:13:43]: -----------------------
[14:13:43]: --- Step: build_app ---
[14:13:43]: -----------------------
[14:13:43]: Resolving Swift Package Manager dependencies...
[14:13:43]: $ xcodebuild -resolvePackageDependencies -workspace ****.xcworkspace -scheme ****
[14:13:44]: ▸ Command line invocation:
[14:13:44]: ▸     /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ****.xcworkspace -scheme ****
[14:13:44]: ▸ User defaults from command line:
[14:13:44]: ▸     IDEPackageSupportUseBuiltinSCM = YES
[14:13:44]: ▸ resolved source packages:
[14:13:44]: $ xcodebuild -showBuildSettings -workspace ****.xcworkspace -scheme **** 2>&1
[14:13:45]: Detected provisioning profile mapping: {"****": "****"}

+---------------------------------------------------------------------------------------------------------------+
|                                            Summary for gym 2.227.0                                            |
+-----------------------------------------------------+---------------------------------------------------------+
| workspace                                           | ****.xcworkspace                                  |
| scheme                                              | ****                                              |
| export_method                                       | app-store                                               |
| export_options.provisioningProfiles.jina.TodayVideo | ****                                            |
| clean                                               | false                                                   |
| output_directory                                    | .                                                       |
| output_name                                         | ****                                              |
| silent                                              | false                                                   |
| skip_package_ipa                                    | false                                                   |
| skip_package_pkg                                    | false                                                   |
| build_path                                          | /Users/user/Library/Developer/Xcode/Archives/2025-04-03 |
| result_bundle                                       | false                                                   |
| buildlog_path                                       | ~/Library/Logs/gym                                      |
| destination                                         | generic/platform=iOS                                    |
| xcodebuild_formatter                                | xcpretty                                                |
| build_timing_summary                                | false                                                   |
| skip_profile_detection                              | false                                                   |
| xcodebuild_command                                  | xcodebuild                                              |
| skip_package_dependencies_resolution                | false                                                   |
| disable_package_automatic_updates                   | false                                                   |
| use_system_scm                                      | false                                                   |
| xcode_path                                          | /Applications/Xcode.app                                 |
+-----------------------------------------------------+---------------------------------------------------------+

[14:13:45]: $ set -o pipefail && xcodebuild -workspace ****
[14:13:57]: ▸ Copying Pods-****-umbrella.h
[14:14:03]: ▸ Processing Info.plist
[14:14:03]: ▸ Linking ****
[14:14:03]: ▸ Running script '[CP] Embed Pods Frameworks'
[14:14:03]: ▸ Generating '****.app.dSYM'
[14:14:03]: ▸ Touching ****.app (in target '****' from project '****')
[14:14:04]: ▸ Archive Succeeded
[14:14:04]: Generated plist file with the following values:
[14:14:04]: ▸ -----------------------------------------
[14:14:04]: ▸ {
[14:14:04]: ▸   "provisioningProfiles": {
[14:14:04]: ▸     "****": "****"
[14:14:04]: ▸   },
[14:14:04]: ▸   "method": "app-store",
[14:14:04]: ▸   "signingStyle": "manual"
[14:14:04]: ▸ }
[14:14:04]: ▸ -----------------------------------------
[14:14:04]: $ /usr/bin/xcrun /opt/homebrew/Cellar/fastlane/2.227.0/libexec/gems/fastlane-2.227.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/_l/z48tz7_d01n18swpgp7tqy0c0000gn/T/gym_config20250403-51778-d5f4e6.plist' ****
[14:14:38]: Compressing 2 dSYM(s)

[14:14:38]: Successfully exported and compressed dSYM file
[14:14:38]: Successfully exported and signed the ipa file:
[14:14:38]: /Users/user/Desktop/github/****.ipa
[14:14:38]: ----------------------------------
[14:14:38]: --- Step: upload_to_testflight ---
[14:14:38]: ----------------------------------
[14:14:38]: To not be asked about this value, you can specify it using 'username'
[14:14:38]: Your Apple ID Username: ****
[14:14:57]: Login to App Store Connect (****)
Available session is not valid anymore. Continuing with normal login.
[14:15:04]: Login successful
[14:15:06]: Ready to upload new build to TestFlight (App: ****)...
[14:15:08]: Going to upload updated app to App Store Connect
[14:15:08]: This might take a few minutes. Please don't interrupt the script.
[14:15:11]: [altool] 2025-04-03 14:15:11.344 *** Error: Unable to upload archive. Failed to get authorization for username '****' and password. (

[14:15:11]: [altool]     "Error Domain=ITunesConnectionOperationErrorDomain Code=-19000 \"Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com\" UserInfo={NSLocalizedRecoverySuggestion=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedDescription=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedFailureReason=App Store operation failed.}"

[14:15:11]: [altool] ) (-1011)

[14:15:11]: [altool]  {

[14:15:11]: [altool]     NSLocalizedDescription = "Unable to upload archive.";

[14:15:11]: [altool]     NSLocalizedFailureReason = "Failed to get authorization for username 'jinagold.k@icloud.com' and password. (\n    \"Error Domain=ITunesConnectionOperationErrorDomain Code=-19000 \\\"Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com\\\" UserInfo={NSLocalizedRecoverySuggestion=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedDescription=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedFailureReason=App Store operation failed.}\"\n)";

[14:15:11]: [altool] }

[14:15:11]: Application Loader output above ^
[14:15:11]: Error uploading '/var/folders/_l/z48tz7_d01n18swpgp7tqy0c0000gn/T/f7a88454-2b49-4b08-a903-ddc2f2c80f06.ipa'.
[14:15:11]: Unable to upload archive. Failed to get authorization for username '****' and password. (
[14:15:11]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.
[14:15:11]: Could not download/upload from App Store Connect!
+---------------------------------------------------------------------------------------+
|                                     Lane Context                                      |
+--------------------+------------------------------------------------------------------+
| DEFAULT_PLATFORM   | ios                                                              |
| PLATFORM_NAME      | ios                                                              |
| LANE_NAME          | ios beta                                                         |
| IPA_OUTPUT_PATH    | /Users/user/Desktop/github/****.ipa  |
| XCODEBUILD_ARCHIVE | /Users/user/Library/Developer/Xcode/Archives/2025-04-03/****  |
|                    | deo 2025-04-03 14.13.45.xcarchive                                |
| DSYM_OUTPUT_PATH   | /Users/user/Desktop/github/****.app  |
|                    | .dSYM.zip                                                        |
+--------------------+------------------------------------------------------------------+
[14:15:11]: Called from Fastfile at line 31
[14:15:11]: 
[14:15:11]:     29:	      }
[14:15:11]:     30:	    )
[14:15:11]:  => 31:	    upload_to_testflight
[14:15:11]:     32:	  end
[14:15:11]:     33:	end
[14:15:11]:

[14:15:11]: Error uploading ipa file:
 [Application Loader Error Output]: Error uploading ****.ipa'.
[Application Loader Error Output]: Unable to upload archive. Failed to get authorization for username '****' and password. (
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.

+-------------------------------------------+
|             fastlane summary              |
+------+----------------------+-------------+
| Step | Action               | Time (in s) |
+------+----------------------+-------------+
| 1    | default_platform     | 0           |
| 2    | build_app            | 55          |
| 💥   | upload_to_testflight | 32          |
+------+----------------------+-------------+

[14:15:11]: fastlane finished with errors

[!] Error uploading ipa file:
 [Application Loader Error Output]: Error uploading '****.ipa'.
[Application Loader Error Output]: Unable to upload archive. Failed to get authorization for username '****' and password. (
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.

 

앱 암호를 생성해야 한다.

생성한 앱 암호를 Fastfile에 적용해보고 .env 파일도 생성하여 적용해보았는데도 실패를 거듭했다.

그래서 Fastlane 폴더와 Gemfile, Gemfile.lock 파일을 삭제 하고 

다시 init

원하는 자동화 작업 1~4 선택 시점에 Testflight 업로드 번호인 2번 선택하여 쭉쭉 진행 

제일 하단에 fastlane beta 글자가 뜨면

vim fastlane/.env
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD="앱 암호"

저장한 후 다시 fastlane beta를 진행했더니

성공...!!

하루종일 해결 안되더니... 역시 삭제하고 다시 하니 해결 완료

 

 

728x90

댓글