как повторно использовать сертификат apple с помощью fastlane match

#ios #fastlane #codesign

Вопрос:

Потому что личный разработчик может иметь только 3 сертификата распространения(https://help.apple.com/xcode/mac/current/#/dev3a05256b8), у меня более 3 приложений, поэтому я должен заставить разные приложения использовать один и тот же сертификат, это то, что я пытаюсь сделать.

Шаг 1: экспортируйте сертификат из связки ключей

введите описание изображения здесь шаг 2. создайте файл сертификата и файл pem с помощью этой команды:

 openssl pkcs12 -nocerts -nodes -out key.pem -in Certificates.p12
openssl aes-256-cbc -k 225843 -in key.pem -out MLD9L5TNVK.p12 -a
openssl aes-256-cbc -k 225843 -in Certificates.cer -out MLD9L5TNVK.cer -a
 

затем добавьте файл MLD9L5TNVK.p12 и MLD9L5TNVK.cer в репозиторий сертификатов, который соответствует управлению fastlane.

введите описание изображения здесь

шаг 3. использование fastlane match для создания файла обеспечения:

 fastlane match adhoc
 

но когда я использую эту команду для публикации пакета ios в действиях GitHub:

   - name: Deploy to TestFlight/PGY
    run: |
      cd ./ios
      bundle exec fastlane beta
    env:
      FLUTTER_ROOT: ${{ secrets.FLUTTER_ROOT }}
      APPLE_ID: ${{ secrets.APPLE_ID }}
      GIT_URL: ${{ secrets.GIT_URL }}
      PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
      PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
      TEAM_ID: ${{ secrets.TEAM_ID }}
      ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
      FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
      FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
      FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
      FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
      MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
      MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
      MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
 

показать это сообщение об ошибке:

 No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
 

это вывод подробного журнала:

  ----------------------------------------------------------- ----------------------------------------------------------- 
|                                                Summary for gym 2.191.0                                                |
 ----------------------------------------------------------- ----------------------------------------------------------- 
| workspace                                                 | Runner.xcworkspace                                        |
| scheme                                                    | Runner                                                    |
| export_method                                             | ad-hoc                                                    |
| export_options.provisioningProfiles.com.reddwarf.musicapp | match AdHoc com.reddwarf.musicapp 1629273389              |
| clean                                                     | false                                                     |
| output_directory                                          | .                                                         |
| output_name                                               | Runner                                                    |
| silent                                                    | false                                                     |
| skip_package_ipa                                          | false                                                     |
| skip_package_pkg                                          | false                                                     |
| build_path                                                | /Users/runner/Library/Developer/Xcode/Archives/2021-08-18 |
| result_bundle                                             | false                                                     |
| buildlog_path                                             | ~/Library/Logs/gym                                        |
| destination                                               | generic/platform=iOS                                      |
| skip_profile_detection                                    | false                                                     |
| skip_package_dependencies_resolution                      | false                                                     |
| disable_package_automatic_updates                         | false                                                     |
| use_system_scm                                            | false                                                     |
| xcode_path                                                | /Applications/Xcode_12.4.app                              |
 ----------------------------------------------------------- ----------------------------------------------------------- 

[10:05:55]: $ set -o pipefail amp;amp; xcodebuild -workspace Runner.xcworkspace -scheme Runner -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2021-08-18/Runner 2021-08-18 10.05.55.xcarchive archive | tee /Users/runner/Library/Logs/gym/Runner-Runner.log | xcpretty
[10:06:00]: ▸ ❌  error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
[10:06:00]: ▸     The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
[10:06:00]: ▸ ** ARCHIVE FAILED **

❌  error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')


    The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
** ARCHIVE FAILED **
[10:06:00]: Exit status: 65
[10:06:00]: 
[10:06:00]: Maybe the error shown is caused by using the wrong version of Xcode
[10:06:00]: Found multiple versions of Xcode in '/Applications/'
[10:06:00]: Make sure you selected the right version for your project
[10:06:00]: This build process was executed using '/Applications/Xcode_12.4.app'
[10:06:00]: If you want to update your Xcode path, either
[10:06:00]: 
[10:06:00]: - Specify the Xcode version in your Fastfile
[10:06:00]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[10:06:00]: 
[10:06:00]: - Specify an absolute path to your Xcode installation in your Fastfile
[10:06:00]: ▸ xcode_select "/Applications/Xcode8.app"
[10:06:00]: 
[10:06:00]: - Manually update the path using
[10:06:00]: ▸ sudo xcode-select -s /Applications/Xcode.app
[10:06:00]: 

 --------------- ------------------------------ 
|              Build environment               |
 --------------- ------------------------------ 
| xcode_path    | /Applications/Xcode_12.4.app |
| gym_version   | 2.191.0                      |
| export_method | ad-hoc                       |
| sdk           | iPhoneOS14.4.sdk             |
 --------------- ------------------------------ 

[10:06:00]: ▸ note: Building targets in parallel
[10:06:00]: ▸ note: Planning build
[10:06:00]: ▸ note: Constructing build description
[10:06:00]: ▸ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
[10:06:00]: ▸ warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
[10:06:00]: 
[10:06:00]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[10:06:00]: 📋  For the complete and more detailed error log, check the full log at:
[10:06:00]: 📋  /Users/runner/Library/Logs/gym/Runner-Runner.log
[10:06:00]: 
[10:06:00]: Looks like fastlane ran into a build/archive error with your project
[10:06:00]: It's hard to tell what's causing the error, so we wrote some guides on how
[10:06:00]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[10:06:00]: Before submitting an issue on GitHub, please follow the guide above and make
[10:06:00]: sure your project is set up correctly.
[10:06:00]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[10:06:00]: the full commands printed out in yellow in the above log.
[10:06:00]: Make sure to inspect the output above, as usually you'll find more error information there
[10:06:00]: 
 ------------------------------------ --------------------------------------------------------------------------- 
|                                                  Lane Context                                                  |
 ------------------------------------ --------------------------------------------------------------------------- 
| DEFAULT_PLATFORM                   | ios                                                                       |
| PLATFORM_NAME                      | ios                                                                       |
| LANE_NAME                          | ios beta                                                                  |
| KEYCHAIN_PATH                      | ~/Library/Keychains/***                                                 |
| ORIGINAL_DEFAULT_KEYCHAIN          | "/Users/runner/Library/Keychains/***.keychain-db"                       |
| SIGH_PROFILE_TYPE                  | ad-hoc                                                                    |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.reddwarf.musicapp"=>"match AdHoc com.reddwarf.musicapp 1629273389"} |
 ------------------------------------ --------------------------------------------------------------------------- 
[10:06:00]: Error building the application - see the log above

 ------ ------------------ ------------- 
|           fastlane summary            |
 ------ ------------------ ------------- 
| Step | Action           | Time (in s) |
 ------ ------------------ ------------- 
| 1    | default_platform | 0           |
| 2    | xcode_select     | 0           |
| 3    | create_keychain  | 0           |
| 4    | is_ci            | 0           |
| 5    | match            | 2           |
| 💥   | build_app        | 8           |
 ------ ------------------ ------------- 

[10:06:00]: fastlane finished with errors

[!] Error building the application - see the log above
Error: Process completed with exit code 1.
 

почему это должно было произойти? что мне следует сделать, чтобы устранить эту проблему?Мы будем признательны за любую помощь. Я не могу отозвать сертификат, потому что сертификат используется сейчас. Я также попытался найти дистрибутив iOS, но не смог:

введите описание изображения здесь

не нашел «дистрибутив iOS».

Ответ №1:

Если вы хотите использовать один сертификат разработчика и/или распространителя для нескольких приложений, принадлежащих одной и той же группе разработчиков, вы можете использовать один и тот же репозиторий и филиал удостоверений подписи для хранения удостоверений подписи для ваших приложений:

Пример сопоставления файлов для приложений № 1 и №2:

 git_url("https://github.com/example/example-repo.git")
git_branch("master")
 

match будет повторно использовать сертификаты и создаст отдельные профили подготовки для каждого приложения.