Search code examples
iosflutterfastlane

exportArchive: Code signing "App.framework" failed


I am using fastlane to generate a build.

Here is my environment detail,

  1. Flutter 3.7.6
  2. XCode 14.2
  3. Fastlane

Here is a some portion of my fastlane script,

//1. Using match to generate certificate and profile.[Code not shown here]

//2. Disabled automatic code singing
disable_automatic_code_signing(path: "Runner.xcodeproj")

//3. Setting code sign to manual
update_code_signing_settings(
      build_configurations: configuration,
      use_automatic_signing: false,
      profile_name: profileName,
      team_id: ENV['IOS_TEAM_ID'],
      code_sign_identity: "iPhone Distribution"
    ) 

//4. Running Flutter build iPa command without code signing. 
sh_on_root(command: "export LANG=en_US.UTF-8 && export PATH=$PATH:/usr/local/bin && flutter build ipa #{params} --no-codesign")

//5. Generating iPA
build_app(
      output_directory: "#{root_path}/build/ios",
      build_path: "#{root_path}/build/ios",
      archive_path: "#{root_path}/build/ios/archive/Runner.xcarchive",
      export_method: method,
      scheme: env,
      configuration: configuration,   
      skip_build_archive: true,  
      workspace: "Runner.xcworkspace",
      export_options: {
        signingStyle: "manual",
        provisioningProfiles: profileMap,  
        teamID: ENV['IOS_TEAM_ID'],
        signingCertificate: "Apple Distribution",
        compileBitcode: false      
      } 
    )

During 5th step, I am getting error Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "App.framework" failed." UserInfo={NSLocalizedDescription=Code signing "App.framework" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}

What I have already tried,

  • Opened up XCode project and checked that all code sign related configurations are looking good. With same settings Archieve is working well from Xcode.
  • Manually Firing flutter build ipa from terminal is working well. I just need to add ExportOptions.plist file.
  • Tried to tweak Podfile not to take up any code signing settings. Reference answer

Any suggestion would be helpful.

Update Firing lane execution command from CD machine's terminal is working fine but when Jenkin is firing same command then it is causing issue of code signing.


Solution

  • In my case, build_app was not able to access keychain and that's why it was showing error of code signing. I used unlock_keychain with the appropriate parameter and it started working.