Xcode archive & export step fails for flutter even though certificates and profiles are installed with fastlane

fastlane
flutter
ios
#1

Description of the issue

I have a Flutter project which has iOS(apart from android) project files autogenerated and the project is commited in our repository.

I am able to build Android apk from bitrise using the modified deploy pipeline(I have replaced Certificate installer step with fastlane match script for iOS signing) after connecting the repo. For iOS I am facing the issue in Xcode archive and export step.

Environment:

Where did the issue happen?

I have started with Flutter bitrise stack and replaced Certificate and profile installer step with script which installs fastlane and then development certificates

bundle install
bundle exec fastlane match appstore

This succeeds though with warning

Installing certificate…

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

[12:29:29]: There are no local code signing identities found.

All required keys, certificates and provisioning profiles are installed :raised_hands:

Build step happens without any error

$ flutter “build” “ios” “–debug” “–no-codesign”

Running Xcode build…
Xcode build done. 37.6s
Built /Users/vagrant/git/build/ios/iphoneos/Runner.app.

***Step that causes the issue

But during xcode archive and export step I am getting this error

$ set -o pipefail && xcodebuild “-workspace” “/Users/vagrant/git/ios/Runner.xcworkspace” “-scheme” “Runner” “-configuration” “Debug” “COMPILER_INDEX_STORE_ENABLE=NO” “archive” “-archivePath” “/[redacted]/Runner.xcarchive” | xcpretty
:x: error: Signing for “Runner” requires a development team. Select a development team in the Signing & Capabilities editor. (in target ‘Runner’ from project ‘Runner’)

Also I can see that it is not detecting team ID in this same step

Configs:

  • ExportMethod: development
  • UploadBitcode: true
  • CompileBitcode: true
  • ICloudContainerEnvironment:
  • TeamID:
  • UseDeprecatedExport: false
  • ForceTeamID:

I am not able to understand what is causing app signing error, even after having installed certificates using fastlane. This happens with both debug and release workflow(I am installing correct version of certificates in the fastlane for the respective workflow). I have attached build logs. Any help would be appreciated.

P.S: We have apple developer account connected to bitrise. Also all the iOS files are generated through Flutter Android studio on Windows and at no point did we use MacOS/Xcode.

Things that did not work

  • I have tried removing build caches and got same error.
  • In a separate workflow(https://app.bitrise.io/build/f0dc7892bf4f2b6e#?tab=log) I also tried signing in the flutter build step itself by removing “–no-codesign” option. Its detecting our dev team but resulting in this error

Config:
-IOSAdditionalParams: --debug
-AndroidAdditionalParams: --release
-Platform: ios
-IOSExportPattern: build/ios/iphoneos/.app
build/ios/iphoneos/.ipa
-AndroidOutputType: apk
-AndroidExportPattern: build/app/outputs/apk//.apk
build/app/outputs/bundle//
.aab
-IOSCodesignIdentity:
-ProjectLocation: /Users/vagrant/git
-DebugMode: false
-AndroidBundleExportPattern: build/app/outputs/bundle//*.aab

iOS Codesign settings
Installed codesign identities:
-Apple Development: [our team info]
Stored Flutter codesign settings:
-No codesign identity set

Build iOS
$ flutter “build” “ios” “–debug”
Building [our appid] for device (ios)…
Signing iOS app for device deployment using developer identity: “Apple Development: [our team id]”
Running Xcode build…
Xcode build done. 2.9s
Failed to build iOS app
Error output from Xcode build:

** BUILD FAILED **
Xcode’s output:

note: Using new build systemnote: Planning buildnote: Constructing build descriptionerror: There are no accounts registered with Xcode. Add your developer account to Xcode (in target ‘Runner’ from project ‘Runner’)error: No profiles for [our appid] were found: Xcode couldn’t find any iOS App Development provisioning profiles matching [our appid]. (in target ‘Runner’ from project ‘Runner’)

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : /NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : /NO
  • Does the issue happen sporadically, or every time? :

Build log

Debug workflow log:

https://app.bitrise.io/build/e834fa239a81310e#?tab=log

Release workflow log:

https://app.bitrise.io/build/55028045fa9e2461#?tab=log

0 Likes

#2

Hi @scorz!

Really sorry about the long delay on this one. Few small things I’d like to point out, like fastlane is installed by default so we only recommend installing it if you need a specific version other than the available one. Also, we have a community based Fastlane Match step that might work better here.

Either way, I’d recommend removing the Certificate and Profile Installer step if you use fastlane match. If this all fails too, we’d like you try using the Certificate and Profile Installer step and upload your identities to Bitrise, so we can tell whether this problem is related to the third-party tool in question or our service.

Hopefully this helps!

0 Likes