dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
573 stars 473 forks source link

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

Closed ndrake closed 2 years ago

ndrake commented 2 years ago

Bug report

CHECKLIST

To reproduce:

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 **

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-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"
Macbook Pro 2021 M1
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115

Runtime issue N/A

Android build issue:
N/A

iOS build issue:

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:**
mikekoopie commented 2 years ago

Are you sure you have selected a development team in the Signing & Capabilities editor? Could you provide a screenshot of this?

ndrake commented 2 years ago

Yep, I've got a dev team selected.

Screen Shot 2022-09-26 at 10 28 11 AM
pedjavujic commented 2 years ago

I have the same problem. Using Volt Buid (Xcode 14) with 14.2.1-cli. With older versions of Xcode was no problem.

gianluigitrontini commented 2 years ago

We're experiencing the same problem both with 14.0.0-cli and 14.2.1-cli after updating to Xcode 14.

EDIT For now, the only way to generate the ipa is by ditching all our CI processes and build + sign manually in Xcode. The issue is likely that certificates for FirebaseX dependencies aren't automatically selected, in fact during the manual build it fails a couple times and we manually had to select our "Team" after clicking on the Pods with errors (inside the list that appears on the left). After that we managed to deploy to App Center successfully!

rex-iotum commented 2 years ago

I have a similar problem with xcode 14.0.1 and building using Fastlane. With this plugin added my project no longer has a development team automatically selected. Removing this plugin stops the issue from happening and my automatic signing/provisioning works again.

jkorrek commented 2 years ago

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 :)

ndrake commented 2 years ago

@jkorrek Thank you for the detailed workaround instructions!

ndrake commented 2 years ago

This is a long shot, is there anyone who is having this issue that applied the workaround that also uses BrowserStack's App Live for on-device testing? When we build our apps with the workaround and the cordova-plugin-firebaseex 14.2.1-cli, they are killed immediately on launch when running in App Live. BrowserStack support said it is something related to the aps-environment entitlement when they resign the app to run on their hardware. Our apps run fine on App Live when we build with cordova-plugin-firebaseex version 13.0.1-cli. Just wondering the problem is being caused by the workaround or some change that's part of 14.2.1-cli.

Thanks for listening! :)

pedjavujic commented 2 years ago

@ndrake I am using Volt Build for building and I didn't applied (also not possible on this platform) workaround but I experience the same problem as you. App crash on the start, with older version of firebase plugin (14.0.0-cli) app start but does not receive any notifications form firebase. FCM token is produced and message is successfully sent (api and firebase console) but in the app there is no notification arising. With older Xcode version there was no problem. Not sure where to look for the solution....

ndrake commented 2 years ago

Well, we released to production and started getting a bunch of crashes (that we couldn't easily reproduce). Crash logs seemed to indicate it was because the Swift runtime was getting embedded in the app. I've noticed that when building with 14.2.1-cli, the XCode project includes the build setting "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES", and when building with 13.0.1-cli that build setting isn't set at all in the XCode project. If I set EMBEDDED_CONTENT_CONTAINS_SWIFT to NO while using 14.2.1-cli, the app seems to no longer crash for me. Setting it to NO also fixes the BrowserStack issue I mentioned in a previous comment.

Bonus mystery, our build.json does specify "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES" so I'm confused why when building with version 13.0.1 that that build setting isn't showing up in XCode.

ndrake commented 2 years ago

Final update, setting deployment-target to 12.3.0 fixes the crashes. I assume we're doing something wrong, as Cordova, this plugin and the Firebase iOS SDK support iOS 11.

mirkocentralix commented 2 years ago

Unfortunately i am having the same problem. I have the latest version of cordova and xcode. :(

gwhenne commented 2 years ago

We're still having this issue - none of the workarounds above have resolved the issue.

While adding ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=yes resulted the build completing, the app crashed immediately on startup. Setting this flag is a poor idea otherwise - it causes problems for other Cordova plugins.

Setting this does not make a difference in our testing:

<preference name="deployment-target" value="12.3.0" />

Outside of the people in this thread, I know at least 5 users who are stuck using Xcode 13 until this is resolved.

Is there any more information which could help resolve this?

QuentinFarizon commented 2 years ago

Hello @dpa99c , why did you close this ? I'm encountering that error on 15.0.0-cli

dpa99c commented 2 years ago

@QuentinFarizon it's closed because AFAIK it's fixed - here's the console output for a successful CLI build of the example project using Xcode 14 and cordova-plugin-firebasex@15.0.0-cli: build_ios.log

If you are still encountering build issues with your own project, I suggest attempting to build the example project since it's a known codebase and therefore rule out the possibility of project-specific issues such as conflict with another plugin. If the build of the example project is unsuccessful, this suggests an issue with your build environment.

QuentinFarizon commented 2 years ago

Hello, thanks @dpa99c. It's a bit complicated to compare projects because I'm using Ionic and building on Bitrise. I am using cordova-plugin-firebasex@15.0.0-cli and Xcode 14.1.x, on macOS 13.0 (Ventura)

Here is the log :

Running command: xcodebuild -workspace Boks preprod.xcworkspace -scheme Boks preprod -configuration Release -destination generic/platform=iOS -archivePath Boks preprod.xcarchive archive CONFIGURATION_BUILD_DIR=/Users/vagrant/git/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/vagrant/git/platforms/ios/build/sharedpch
Command line invocation:
    /Applications/Xcode-14.1.app/Contents/Developer/usr/bin/xcodebuild -workspace "Boks preprod.xcworkspace" -scheme "Boks preprod" -configuration Release -destination generic/platform=iOS -archivePath "Boks preprod.xcarchive" archive CONFIGURATION_BUILD_DIR=/Users/vagrant/git/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/vagrant/git/platforms/ios/build/sharedpch
User defaults from command line:
    IDEArchivePathOverride = /Users/vagrant/git/platforms/ios/Boks preprod.xcarchive
    IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/vagrant/git/platforms/ios/build/device
    SHARED_PRECOMPS_DIR = /Users/vagrant/git/platforms/ios/build/sharedpch
Prepare packages
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: ff6bb943086a392435351263ffa8f213
Build description path: /Users/vagrant/Library/Developer/Xcode/DerivedData/Boks_preprod-axpubthxykkfxvhflqqrgrpvwivc/Build/Intermediates.noindex/ArchiveIntermediates/Boks preprod/IntermediateBuildFilesPath/XCBuildData/ff6bb943086a392435351263ffa8f213-desc.xcbuild
note: Building targets in dependency order
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'gRPC-Core' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'Curve25519' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'abseil' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'SwiftProtobuf' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GoogleSignIn-GoogleSignIn' from project 'Pods')
/Users/vagrant/git/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')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'gRPC-C++' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
warning: Run script build phase 'Copy www directory' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Boks preprod' from project 'Boks preprod')
warning: Run script build phase 'Crashlytics' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Boks preprod' from project 'Boks preprod')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'PromisesObjC' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'FirebaseCoreExtension' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'Libuv-gRPC' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Libuv-gRPC' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'iOSDFULibrary' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'ZIPFoundation' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'FirebaseCoreInternal' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GTMSessionFetcher' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
/Users/vagrant/git/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')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GoogleSignIn' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GoogleAppMeasurement' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'AppAuth' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GTMAppAuth' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'FirebaseAppCheckInterop' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'nanopb' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'FirebaseCore' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'leveldb-library' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GoogleUtilities' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'FirebaseInstallations' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GoogleDataTransport' from project 'Pods')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'FirebaseAnalytics' from project 'Pods')
** ARCHIVE FAILED **
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

        cordova build ios --release --device --buildConfig /var/folders/11/nh0v1jld7zd7b... exited with exit code 65.

        Re-running this command with the --verbose flag may provide more information.
command failed, error: exit status 65
dpa99c commented 2 years ago

Bitrise is a remote build environment and as outlined in the documentation, this plugin will not work in such environments if they do not support Cordova hook scripts which are essential for this plugin to function correctly.

I don't know if Bitrise supports Cordova hook scripts - you'd have to check - but I highly recommend a local build environment which you have full control over. I'm unable to offer support for projects in a remote build environment which is not under your direct control or where the example project cannot be built as a known working test case to validate the build environment.

QuentinFarizon commented 2 years ago

Yes it fully supports Cordova hooks script, I'm using dozens of Cordova plugins inclusing yours, and had no issue with remote builds on Bitrise for 3 years

dpa99c commented 2 years ago

The errors in your build log indicate either the build script, or the pod post-install script it injects into the Podfile, is not being executed:

/Users/vagrant/git/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')
/Users/vagrant/git/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'gRPC-C++' from project 'Pods')

This issue was raised because CLI builds with Xcode 14 were failing because Xcode 14 made changes to the default Xcode project settings. Therefore, I made this commit which is present in v15.0.0/v15.0.0-cli which injects a post-install script into the Podfile which runs after pod install and changes these settings so the CLI build will succeed. Specifically, it sets CODE_SIGNING_ALLOWED=NO in each Pod target to prevent signing errors such as the one above with GoogleSignIn. It also sets the IPHONEOS_DEPLOYMENT_TARGET to the same value as the Podfile's platform :ios version to prevent deployment target mismatches as shown in your build log.

If I open platforms/ios/Pods/Pods.xcodeproj/project.pbxproj in a text editor, I should see that each XCBuildConfiguration block has CODE_SIGNING_ALLOWED = NO and IPHONEOS_DEPLOYMENT_TARGET = 11.0 - you can see this in the project.pbxproj from my example project build above: project.pbxproj

Therefore given the output in your build log, I would conclude this step is failing.

In a local build environment, you could manually inspect the project.pbxproj file to confirm this.

If the after_prepare hook script has run successfully, you should see the following log message in the console output: cordova-plugin-firebasex: Applied post install block to Podfile

And should be able to confirm if the post_install block is present in the Podfile.

dpa99c commented 2 years ago

@QuentinFarizon this issue with Bitrise could be the same that is affecting @gwhenne when building using the VoltBuilder remote build service so keep an eye on his feedback in #780

QuentinFarizon commented 2 years ago

@dpa99c Yes, I do also have :

cordova-plugin-firebasex: Preparing Firebase on Android
cordova-plugin-firebasex: Updated colors.xml with accent color
cordova-plugin-firebasex: Preparing Firebase on iOS
cordova-plugin-firebasex: Configured Podfile for pre-built Firestore pod
cordova-plugin-firebasex: Updating installed Pods

But not cordova-plugin-firebasex: Applied post install block to Podfile

QuentinFarizon commented 2 years ago

@dpa99c I'm seeing that post-install block is conditionned by a check that no post_install step already exists : https://github.com/dpa99c/cordova-plugin-firebasex/commit/94445be981f1fc212d81b3aa5af694a64e378fe9#diff-4c63363a4ed67bec213b7a24798f0661d2997a4eab3fabc8be02b1b1ab18be08R192

But I do already have one (probably by cordova-plugin-add-swift-support) :

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '5'
    end
  end
end

So modifications by your plugins are just skipped

dpa99c commented 2 years ago

Yes, the presence of a post_install block injected by the other plugin would cause this plugin's after_prepare script not to inject its own block. It's not clear from the documentation if multiple post_install blocks are supported but the answers to this SO Q suggest it is. This plugin's script would need to ensure it didn't inject its own block multiple times but maybe it could do so by injecting/detecting a unique comment rather than post_install itself.

As an aside, is cordova-plugin-add-swift-support still necessary now that cordova-ios itself supports Swift?

QuentinFarizon commented 2 years ago

Yes, cordova-plugin-add-swift-support is still needed, my build failed when removing it

gwhenne commented 2 years ago

@QuentinFarizon this issue with Bitrise could be the same that is affecting @gwhenne when building using the VoltBuilder remote build service so keep an eye on his feedback in #780

It appears VoltBuilder jobs are getting past the hook step successfully, based on the messages in the log. The current problem is later in the build, at the Code Signing step. The tests I am running do not use cordova-plugin-add-swift-support, so that appears to be a separate issue.

QuentinFarizon commented 2 years ago

Sorry, it wasn't cordova-plugin-add-swift-support that put this block, but cordova-plugin-ble-central.
In your case, that could be another plugin. I have grepped config.build_settings in node_modules to find out.

I'm currently trying to patch other plugin(s?) interfering with post_install step in Podfile It's not supported to have multiple post_install blocks, so not sure how this could be properly managed by cordova-plugin-firebasex plugin without some more clever parsing

QuentinFarizon commented 2 years ago

Ok, indeed cordova-plugin-add-swift-support is not needed since cordova-iod 6.2.0 (thanks @dpa99c for pointing that out). By updating plugins that overwrote Podfile for Swit support, it's now preparing/building OK (at least concerning Swift support)

dlandtaa commented 1 year ago

The only way I was able to resolve this in an automated fashion (I'm using fastlane on jenkins) was to let cordova install the iOS platform, update the Podfile with the post_install script, then reinstall the pods in order to make the post_install script actually run.

As far as I know, this cannot be done using a cordova hook because you'd need one that runs after the Podfile has been created but before pod install runs and I don't think there is such a hook. I wrote a bash script that does something like this:

Add the following to a file called Podfile_ext:

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

Create a bash script with the following:

cordova platforms add ios # the initial Podfile without the post_install block is created and run here
cordova prepare ios
cd platforms/ios
cat Podfile_ext >> Podfile # add the post_install block
pod deintegrate
pod clean
pod install # post_install block is run

At this point you should be able to build the project.