cordova-plugin-firebasex: Unable to build app using cordova-plugin-firebaseex 14.2.1-cli with Xcode 14 and Cordova CLI

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.

To reproduce:

  • git clone https://github.com/dpa99c/cordova-plugin-firebasex-test
  • npm install
  • cordova platform add android
  • cordova platform add ios
  • cordova build ios --device --debug

Expected output is a successful build. Actual error output is (NOTE this isn’t the full output just the errors):

~/othersrc/cordova-plugin-firebasex-test/platforms/ios/FirebaseTest.xcodeproj: error: Signing for "FirebaseTest" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'FirebaseTest' from project 'FirebaseTest')
~/othersrc/cordova-plugin-firebasex-test/platforms/ios/Pods/Pods.xcodeproj: error: Signing for "gRPC-C++-gRPCCertificates-Cpp" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
~/othersrc/cordova-plugin-firebasex-test/platforms/ios/Pods/Pods.xcodeproj: error: Signing for "GoogleSignIn-GoogleSignIn" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'GoogleSignIn-GoogleSignIn' from project 'Pods')
~/othersrc/cordova-plugin-firebasex-test/platforms/ios/Pods/Pods.xcodeproj: error: Signing for "FirebaseInAppMessaging-InAppMessagingDisplayResources" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'FirebaseInAppMessaging-InAppMessagingDisplayResources' from project 'Pods')
** ARCHIVE FAILED **
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:

We’re in the process of upgrading a Cordova-based app to use the latest plugins, lastest XCode, etc. When I update the project to use cordova-plugin-firebaseex 14.2.1-cli, the iOS build is failing.

I’ve been able to reproduce the issue with the dpa99c/cordova-plugin-firebasex-test repo. See steps above.

Our app fails to build with a similar message to the dpa99c/cordova-plugin-firebasex-test:

~/src/MYAPP/platforms/ios/Pods/Pods.xcodeproj: error: Signing for "GoogleSignIn-GoogleSignIn" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'GoogleSignIn-GoogleSignIn' from project 'Pods')

Expected behavior:

iOS build completes without errors

Steps to reproduce:

Build steps for our app are similar to the reproduction steps specified above with the test repo.

Screenshots

Environment information

  • Cordova CLI version
    • 11.0.0
  • Cordova platform version
  android 11.0.0
  ios 6.2.0
Available platforms:
  browser ^6.0.0
  electron ^3.0.0
  osx ^6.0.0
  • Plugins & versions installed in project (including this plugin)
cordova-android-play-services-gradle-release 4.0.0 "cordova-android-play-services-gradle-release"
cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-custom-config 5.1.1 "cordova-custom-config"
cordova-plugin-android-tv 1.0.0 "AndroidTVPlugin"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.14 "AppVersion"
cordova-plugin-battery-status 2.0.3 "Battery"
cordova-plugin-calendar 5.1.6 "Calendar"
cordova-plugin-camera 6.0.0 "Camera"
cordova-plugin-certificates 0.6.4 "Certificate Plugin"
cordova-plugin-device 2.1.0 "Device"
cordova-plugin-email-composer 0.10.1 "EmailComposer"
cordova-plugin-file-transfer 2.0.0-dev "File Transfer"
cordova-plugin-file 7.0.0 "File"
cordova-plugin-firebasex 14.2.1-cli "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-network-information 3.0.0 "Network Information"
cordova-plugin-tts 0.2.3 "TTS"
cordova-plugin-whitelist 1.3.5 "Whitelist"
cordova-plugin-wkwebview-file-xhr 3.1.0 "Cordova WKWebView File XHR Plugin"
  • Dev machine OS and version, e.g.
Macbook Pro 2021 M1
ProductName:	macOS
ProductVersion:	12.6
BuildVersion:	21G115

Runtime issue N/A

Android build issue: N/A

iOS build issue:

  • Node JS version
    • v16.15.0
  • XCode version
    • 14.0 (14A309)

Related code:

insert any relevant code here such as plugin API calls / input parameters

Console output

console output

// Paste any relevant JS/native console output here



Other information:

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I was able to workaround this issue with a combination of a cordova hook & pods post_install script.

It seems like XCode 14 changed the default of CODE_SIGNING_ALLOWED option from NO to YES. A pods post_install script can be used as a workaround, to set it to NO. (More infos: https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1201464693)

We can add the required post_install script with a cordova hook (similiar to the approach described here: https://github.com/dpa99c/cordova-plugin-firebasex/issues/735#issuecomment-1180019463).

My final configuration / fix looks like this:

Add a hook to the ios platform inside config.xml:

<hook src="hooks/firebaseDeploymentTargetFix.js" type="after_prepare" />

The hook itself looks like this:

#!/usr/bin/env node

// Workaround for https://github.com/dpa99c/cordova-plugin-firebasex/issues/766
// set CODE_SIGNING_ALLOWED to NO to avoid signing errors during CI Builds

const fs = require("fs");
const path = require("path");
const execa = require("execa");

module.exports = (context) => {
  const platformPath = path.resolve(context.opts.projectRoot, "platforms/ios");
  const podfilePath = path.resolve(platformPath, "Podfile");

  if (!fs.existsSync(podfilePath)) {
    console.log(`'${podfilePath}' does not exist. Firebase deployment fix skipped.`);
    return;
  }

  let podfileContent = fs.readFileSync(podfilePath, "utf-8");
  if (podfileContent.indexOf("post_install") == -1) {
    podfileContent += `

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

`;

    fs.writeFileSync(podfilePath, podfileContent, "utf-8");

    return execa("pod", ["install", "--verbose"], {
      cwd: platformPath,
    });
  }
};

There is probably a more sensible way to fix the problem. In the meantime, this might help some of you to get your builds going again 😃