andrehtissot / cordova-plugin-fcm-image-support

FCM Image Support for Cordova iOS
MIT License
2 stars 2 forks source link

No image in the Notification #2

Open sirineKr opened 3 years ago

sirineKr commented 3 years ago

Hello, Is this plugin compatible with cordova-plugin-fcm-with-dependecy-updated version 6.4.3 ? I use the cordova-plugin-fcm-with-dependecy-updated plugin to receive iOS notifications. I receive them well. I added this plugin for image support. I added the url of the image in the attribute "image" of the object "fcm_options". And I added "mutable-content":1 in the "aps" object. I receive the notifications but without any image in the notification. Thank you in advance

andrehtissot commented 3 years ago

Hello,

Hi, how are you?

Is this plugin compatible with cordova-plugin-fcm-with-dependecy-updated version 6.4.3 ?

It can't conflict with any versions of cordova-plugin-fcm-with-dependecy-updated due to working in a far different way in different files.

I use the cordova-plugin-fcm-with-dependecy-updated plugin to receive iOS notifications. I receive them well.

Good to know :)

I added this plugin for image support. I added the url of the image in the attribute "image" of the object "fcm_options". And I added "mutable-content":1 in the "aps" object.

Also both keys inside "message" => "apns", like in the Google's example https://firebase.google.com/docs/cloud-messaging/ios/send-image#build_the_send_request?

I receive the notifications but without any image in the notification.

Interesting.

Thank you in advance

Thank you for reaching out.

andrehtissot commented 3 years ago

Would you share your main project.pbxproj file?

sirineKr commented 3 years ago

Thank you for your response. For information, I work with the ionic framework. I send this data :

{
  "message": {
    "notification": {
      "title": "titre",
      "body": "body"
    },
    "token": "XXXXXXXXXXXXX",
    "apns": {
      "payload": {
        "aps": {
          "badge": 53,
          "mutable-content": 1
        }
      },
      "fcm_options": {
        "image": "url-to-image"
      }
    }
  }
}

JMobile.xcodeproj.zip

andrehtissot commented 3 years ago

You project.pbxproj was only partially configured. Probably due to not being able to patch "platforms/ios/cordova/lib/prepare.js". Would you share the console log of uninstalling and installing this plugin? There should be a warning message of its failure.

sirineKr commented 3 years ago

If I install the plugin before adding the iOS platform. I have the following result:

add_plugin_before_adding_ios_platform

If I install the plugin after adding the iOS platform. I get the following result:

add_plugin_after_adding_ios_platform

If I uninstall the plugin. I have the following result:

uninstall_plugin
andrehtissot commented 3 years ago

If I install the plugin before adding the iOS platform. I have the following result:

add_plugin_before_adding_ios_platform

This was that I expected. Which confuses me, because either the ios platform is missing from the project, or the build scripts (lib/prepare) is not accessible in the expected directory. Would you verify on which directory, relative to the project root, the cordova-ios package is installed? And which version of cordova-ios you have installed?

If I install the plugin after adding the iOS platform. I get the following result:

add_plugin_after_adding_ios_platform

It's just a warning. Future versions of cordova-plugin-fcm-with-dependecy-updated won't trigger this warning, but as it is, is nothing important.

If I uninstall the plugin. I have the following result:

uninstall_plugin

Thank you for providing these screenshots.

sirineKr commented 3 years ago

Would you verify on which directory, relative to the project root, the cordova-ios package is installed? node_modules/cordova-ios And which version of cordova-ios you have installed? I installed cordova-ios 5.1.1.

andrehtissot commented 3 years ago

Then it should have found the file. 🤷‍♂️

Would share the console results of the execution of the commands bellow?

ls platforms/ios/cordova
ls platforms/ios/cordova/lib
ls node_modules/cordova-ios
ls node_modules/cordova-ios/bin/templates
ls node_modules/cordova-ios/bin/templates/scripts
ls node_modules/cordova-ios/bin/templates/scripts/cordova
ls node_modules/cordova-ios/bin/templates/scripts/cordova/lib

I believe my intention here is clear. You have the correct dependencies, but the files that should be patched are not available.

Another, faster, approach for our communication would be for you to share an accessible repository with a similar (or same) app, of which you face the same issue and I can debug.

sirineKr commented 3 years ago

Would share the console results of the execution of the commands bellow? ls platforms/iOS/cordova

Capture d’écran 2020-08-18 à 10 49 36

ls platforms/ios/cordova/lib

Capture d’écran 2020-08-18 à 10 49 44

ls node_modules/cordova-ios

Capture d’écran 2020-08-18 à 10 50 15

ls node_modules/cordova-ios/bin/templates

Capture d’écran 2020-08-18 à 10 50 38

ls node_modules/cordova-ios/bin/templates/scripts

Capture d’écran 2020-08-18 à 10 50 50

ls node_modules/cordova-ios/bin/templates/scripts/cordova

Capture d’écran 2020-08-18 à 10 51 04

ls node_modules/cordova-ios/bin/templates/scripts/cordova/lib

Capture d’écran 2020-08-18 à 10 51 12

Another, faster, approach for our communication would be for you to share an accessible repository with a similar (or same) app, of which you face the same issue and I can debug. Attached is a test application that contains the plugin cordova-plugin-fcm-with-dependecy-updated V6.3.0 and cordova-plugin-fcm-image-support. To test the application:

andrehtissot commented 3 years ago

Thank you @sirineKr,

I've followed the steps and got it working. The part that was missing from your project.pbxproj was, something like this:

        3E7143FB24607362001886A3 /* Debug */ = {
            isa = XCBuildConfiguration;
            buildSettings = {
                ALWAYS_SEARCH_USER_PATHS = NO;
                CLANG_ANALYZER_NONNULL = YES;
                CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
                CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
                CLANG_CXX_LIBRARY = "libc++";
                CLANG_ENABLE_OBJC_WEAK = YES;
                CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
                CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
                CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
                CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
                CODE_SIGN_STYLE = Automatic;
                COPY_PHASE_STRIP = NO;
                DEBUG_INFORMATION_FORMAT = dwarf;
                GCC_C_LANGUAGE_STANDARD = gnu11;
                GCC_DYNAMIC_NO_PIC = NO;
                GCC_OPTIMIZATION_LEVEL = 0;
                GCC_PREPROCESSOR_DEFINITIONS = (
                    "DEBUG=1",
                    "$(inherited)",
                );
                GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
                GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
                INFOPLIST_FILE = FCMNotificationService/Info.plist;
                IPHONEOS_DEPLOYMENT_TARGET = 13.2;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
                MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
                MTL_FAST_MATH = YES;
                PRODUCT_BUNDLE_IDENTIFIER = com.jalios.jmobile.FCMNotificationService;
                PRODUCT_NAME = "$(TARGET_NAME)";
                SKIP_INSTALL = YES;
                TARGETED_DEVICE_FAMILY = "1,2";
            };
            name = Debug;
        };
        3E7143FC24607362001886A3 /* Release */ = {
            isa = XCBuildConfiguration;
            buildSettings = {
                ALWAYS_SEARCH_USER_PATHS = NO;
                CLANG_ANALYZER_NONNULL = YES;
                CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
                CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
                CLANG_CXX_LIBRARY = "libc++";
                CLANG_ENABLE_OBJC_WEAK = YES;
                CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
                CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
                CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
                CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
                CODE_SIGN_STYLE = Automatic;
                COPY_PHASE_STRIP = NO;
                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
                ENABLE_NS_ASSERTIONS = NO;
                GCC_C_LANGUAGE_STANDARD = gnu11;
                GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
                GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
                INFOPLIST_FILE = FCMNotificationService/Info.plist;
                IPHONEOS_DEPLOYMENT_TARGET = 13.2;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
                MTL_ENABLE_DEBUG_INFO = NO;
                MTL_FAST_MATH = YES;
                PRODUCT_BUNDLE_IDENTIFIER = com.jalios.jmobile.FCMNotificationService;
                PRODUCT_NAME = "$(TARGET_NAME)";
                SKIP_INSTALL = YES;
                TARGETED_DEVICE_FAMILY = "1,2";
                VALIDATE_PRODUCT = YES;
            };
            name = Release;
        };

This excerpt was taken from the file built by running ionic cordova run ios on your app. So nothing special here.

As it is an app extension, it cannot have the same bundler as the app, therefore the FCMNotificationService suffix. 😞

No idea why it failed to generate yours correctly