havesource / cordova-plugin-push

Register and receive push notifications
MIT License
149 stars 284 forks source link

Build fails using `xcodebuild` command on xcode 14.2 #233

Closed yqian-eab closed 1 year ago

yqian-eab commented 1 year ago

Bug Report

Getting errors during xcodebuild

Expected Behaviour

Build succeeds after running pod install, then xcodebuild

Actual Behaviour

Getting the following error:

<path to project>/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.c:20:10: fatal error: 
      'GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h' file not found
#include "GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/<path to project>/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.c:20:10: note: 
      did not find header 'GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h' in framework 'GoogleDataTransport' (loaded from
      '/Users/xxx/Library/Developer/Xcode/DerivedData/App-etomyzppbrvbjogoahfetmdmjmiy/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/GoogleDataTransport')
1 error generated.

Already tried:

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

(Android) Device Vendor (e.g. Samsung, HTC, Sony...)

cordova info Printout

Cordova Packages:

    cli: 11.1.0
        common: 4.1.0
        create: 4.1.0
        lib: 11.1.0
            common: 4.1.0
            fetch: 3.1.0
            serve: 4.0.1

Project Installed Platforms:

    android: 10.1.2
    ios: 6.2.0

Project Installed Plugins:

    @havesource/cordova-plugin-push: 3.0.1
    branch-cordova-sdk: 3.4.0
    cordova-plugin-androidx-adapter: 1.1.3
    cordova-plugin-calendar: 5.1.6
    cordova-plugin-device: 2.1.0
    cordova-plugin-email-composer: 0.10.1
    cordova-plugin-file: 7.0.0
    cordova-plugin-inappbrowser: 5.0.0
    cordova-plugin-ionic-keyboard: 2.2.0
    cordova-plugin-ionic-webview: 5.0.0
    cordova-plugin-network-information: 3.0.0
    cordova-plugin-safariviewcontroller: 2.0.0
    cordova-plugin-splashscreen: 6.0.2
    cordova-plugin-statusbar: 3.0.0
    cordova-plugin-x-socialsharing: 6.0.4
    es6-promise-plugin: 4.2.2
    newrelic-cordova-plugin: 5.0.0
    urbanairship-cordova: 7.6.0

Environment:

    OS: macOS Monterey 12.6.4 (21G526) (darwin 21.6.0) x64
    Node: v18.14.2
    npm: 9.5.0

android Environment:

    android:
ERROR: Command failed with ENOENT: avdmanager list target
spawn avdmanager ENOENT

ios Environment:

    xcodebuild:
Xcode 14.2
Build version 14C18

Project Setting Files:

    config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="xxx" id="xxx" version="xxx" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android">
    <name>App</name>
    <description></description>
    <author email="xxx" href="xxx">xxx</author>
    <content src="index.html" />
    <allow-navigation href="*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="http:*" />
    <allow-intent href="https:*" />
    <allow-intent href="tel:*" />
    <access launch-external="yes" origin="tel:*" />
    <access launch-external="yes" origin="mailto:*" />
    <access origin="cdvfile://*" />
    <access allows-arbitrary-loads-in-web-content="true" allows-local-networking="true" origin="*" />
    <preference name="Scheme" value="https" />
    <preference name="MixedContentMode" value="0" />
    <preference name="Orientation" value="portrait" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="AndroidLaunchMode" value="singleInstance" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="FadeSplashScreen" value="false" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="deployment-target" value="11.0" />
    <preference name="AndroidXEnabled" value="true" />
    <preference name="android-minSdkVersion" value="24" />
    <preference name="android-targetSdkVersion" value="31" />
    <preference name="target-device" value="handset" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    <preference name="com.urbanairship.in_production" value="false" />
    <preference name="com.urbanairship.auto_launch_message_center" value="false" />
    <preference name="com.urbanairship.notification_icon" value="icon_android" />
    <preference name="com.urbanairship.notification_accent_color" value="#C1C4C7" />
    <preference name="iosPersistentFileLocation" value="Library" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <preference name="GradlePluginGoogleServicesEnabled" value="true" />
    <preference name="GradlePluginGoogleServicesVersion" value="4.3.10" />
    <platform name="android">
        <resource-file src="google-services.json" target="app/google-services.json" />
        <access launch-external="yes" origin="mailto:*" />
        <config-file parent="/manifest" target="AndroidManifest.xml">
            <queries>
                <intent>
                    <action android:name="android.support.customtabs.action.CustomTabsService" />
                </intent>
            </queries>
            <queries>
                <intent>
                    <action android:name="android.intent.action.SENDTO" />
                    <data android:scheme="mailto" />
                </intent>
            </queries>
        </config-file>
    </platform>
    <platform name="ios">
        <edit-config file="*-Info.plist" mode="merge" target="LSApplicationQueriesSchemes">
            <array>
                <string>googlegmail</string>
                <string>ms-outlook</string>
                <string>ymail</string>
            </array>
        </edit-config>
        <preference name="WKWebViewOnly" value="true" />
        <feature name="CDVWKWebViewEngine">
            <param name="ios-package" value="CDVWKWebViewEngine" />
        </feature>
        <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
    </platform>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" />
    <branch-config>
        <branch-key value="xxx" />
        <uri-scheme value="xxx" />
        <link-domain value="xxx" />
        <ios-team-release value="xxx" />
    </branch-config>
    <feature name="Calendar">
        <variable name="CALENDAR_USAGE_DESCRIPTION" value="Allows app to add important dates to your calendar." />
        <param name="ios-package" value="Calendar" />
        <param name="android-package" value="nl.xservices.plugins.Calendar" />
    </feature>
    <feature name="Device">
        <param name="ios-package" value="CDVDevice" />
        <param name="android-package" value="org.apache.cordova.device.Device" />
    </feature>
    <feature name="File">
        <param name="ios-package" value="CDVFile" />
        <param name="android-package" value="org.apache.cordova.file.FileUtils" />
    </feature>
    <feature name="FileTransfer">
        <param name="ios-package" value="CDVFileTransfer" />
        <param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" />
    </feature>
    <feature name="SocialSharing">
        <param name="android-package" value="nl.xservices.plugins.SocialSharing" />
        <param name="ios-package" value="SocialSharing" />
    </feature>
    <engine name="ios" spec="6.2.0" />
    <engine name="android" spec="10.1.2" />
    <plugin name="branch-cordova-sdk" spec="3.4.0" />
    <plugin name="cordova-plugin-androidx-adapter" spec="1.1.3" />
    <plugin name="cordova-plugin-calendar" spec="5.1.6" />
    <plugin name="cordova-plugin-device" spec="2.1.0" />
    <plugin name="cordova-plugin-file" spec="7.0.0" />
    <plugin name="cordova-plugin-splashscreen" spec="6.0.2" />
    <plugin name="cordova-plugin-statusbar" spec="3.0.0" />
    <plugin name="cordova-plugin-inappbrowser" spec="5.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="2.2.0" />
    <plugin name="cordova-plugin-ionic-webview" spec="5.0.0" />
    <plugin name="cordova-plugin-network-information" spec="3.0.0" />
    <plugin name="cordova-plugin-safariviewcontroller" spec="2.0.0" />
    <plugin name="cordova-plugin-x-socialsharing" spec="6.0.4" />
    <plugin name="cordova-plugin-email-composer" spec="0.10.1" />
    <plugin name="newrelic-cordova-plugin" spec="5.0.0" />
</widget>

    package.json:
--- Start of Cordova JSON Snippet ---
{
  "platforms": [
    "android",
    "ios"
  ],
  "plugins": {
    "branch-cordova-sdk": {},
    "cordova-plugin-androidx-adapter": {},
    "cordova-plugin-calendar": {},
    "cordova-plugin-device": {},
    "cordova-plugin-file": {},
    "cordova-plugin-splashscreen": {},
    "cordova-plugin-statusbar": {},
    "cordova-plugin-inappbrowser": {},
    "cordova-plugin-ionic-keyboard": {},
    "cordova-plugin-ionic-webview": {},
    "cordova-plugin-network-information": {},
    "cordova-plugin-safariviewcontroller": {},
    "cordova-plugin-x-socialsharing": {},
    "cordova-plugin-email-composer": {},
    "newrelic-cordova-plugin": {},
    "@havesource/cordova-plugin-push": {
      "ANDROIDX_CORE_VERSION": "1.6.+",
      "FCM_VERSION": "18.+",
      "IOS_FIREBASE_MESSAGING_VERSION": "~> 6.32.2"
    },
    "urbanairship-cordova": {}
  }
}
--- End of Cordova JSON Snippet ---

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

kenfouo commented 1 year ago

it's the version of firebase that is the problem I fixed the problem here, it worked for me.

cordova plugin add github:kenfouo/cordova-plugin-push

yqian-eab commented 1 year ago

Hi @kenfouo , can you explain more about what you changed in the repo? Thanks

kenfouo commented 1 year ago

I explain it here https://github.com/havesource/cordova-plugin-push/issues/228#issuecomment-1511031454

yqian-eab commented 1 year ago

@kenfouo I tried bumping the version firebase version to 8.1.1, I got a different but similar error:

fatal error: 
      'GoogleUtilities/Environment/Public/GoogleUtilities/GULSecureCoding.h' file not found
alasdairhendry commented 1 year ago

I've been battling with our cordova app on iOS all week. I've been having similar issues to you, although not entirely the same.

I followed @kenfouo's comment and updated ./cordova/package.json to the following, and it still doesn't work.

 "cordova": {
    "plugins": {
      "@havesource/cordova-plugin-push": {
        "ANDROIDX_CORE_VERSION": "1.6.+",
        "FCM_VERSION": "23.+",
        "IOS_FIREBASE_MESSAGING_VERSION": "~> 8.1.1"
      }
    },
    "platforms": [
      "ios"
    ]
  }

I've found the only thing that works for me is updating to 4.0.0-dev.0 of the plugin.

cordova plugin remove @havesource/cordova-plugin-push
cordova plugin add @havesource/cordova-plugin-push@4.0.0-dev.0

This breaks our android build unfortunately, but we're just staying on 3.0.1 for android.

FYI, seems the plugin is totally broken on XCode 14.3 so avoid updating to that for now.

yqian-eab commented 1 year ago

I've tried:

I think it's a step forward by including pod 'Firebase/Messaging', '8.1.1' in my podfile, but adding different combinations of

Depending on the different combinations, I keep getting one of the two errors: 'GoogleUtilities/Environment/Public/GoogleUtilities/GULSecureCoding.h' file not found or 'GoogleUtilities/UserDefaults/Public/GoogleUtilities/GULUserDefaults.h' file not found

I'm using cocoapods version 1.11.3

ravi-bozz commented 1 year ago

@yqianeab do we have any update on 62741

For me while doing a pod install

`ios % BOSS>>pod install Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5 Analyzing dependencies Downloading dependencies Installing Firebase 8.1.1 (was 6.32.2) Installing FirebaseCore 8.1.0 (was 6.10.2) Installing FirebaseCoreDiagnostics 8.15.0 (was 1.7.0) Installing FirebaseInstallations 8.15.0 (was 1.7.0) Installing FirebaseMessaging 8.1.0 (was 4.6.2) Installing GoogleDataTransport 9.2.5 (was 7.5.1) Installing GoogleUtilities 7.11.5 (was 6.7.2) Installing PromisesObjC 2.3.1 (was 1.2.12) Installing nanopb 2.30908.0 (was 1.30906.0) Removing FirebaseInstanceID Removing Protobuf Generating Pods project Integrating client project Pod installation complete! There is 1 dependency from the Podfile and 9 total pods installed.

[!] The HybridStudio [Debug] target overrides the LD_RUNPATH_SEARCH_PATHS build setting defined in `Pods/Target Support Files/Pods-HybridStudio/Pods-HybridStudio.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[!] The HybridStudio [Release] target overrides the LD_RUNPATH_SEARCH_PATHS build setting defined in `Pods/Target Support Files/Pods-HybridStudio/Pods-HybridStudio.release.xcconfig'. This can lead to problems with the CocoaPods installation

why it removes the following - Removing FirebaseInstanceID Removing Protobuf

after using @kenfouo forked plugin a build from xcode. cordova plugin add github:kenfouo/cordova-plugin-push then if i run cordova plugin ls it shows @havesource/cordova-plugin-push 4.0.0-dev.0 "Cordova Push Plugin" which plugin should be used am confused.

erisu commented 1 year ago

This issue should have been resolved with the latest released version 4.0.0. Please reinstall the plugin and try again.

github-actions[bot] commented 5 days ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.