infobip / mobile-messaging-react-native-plugin

Mobile Messaging SDK plugin for React Native projects
24 stars 4 forks source link

Crash issue on SDK version 7.0.3 & 8.0.0 #60

Closed aitdigitaltechnology closed 1 year ago

aitdigitaltechnology commented 1 year ago

We integrated SDK Mobile Messaging SDK version 7.0.3 and getting this error: "Error: You attempted to set the key reactNativePluginVersion with the value "7.0.3" on an object that is meant to be immutable and has been frozen." According to this releases document: https://github.com/infobip/mobile-messaging-react-native-plugin/releases, looks like some crash issues on Android 12 has been resolved in SDK version 8.0.0, we remove the SDK version 7.0.3, cleaned the code and re-integrated with SDK version 8.0.0 but getting the same issue: "Error: You attempted to set the key reactNativePluginVersion with the value "8.0.0" on an object that is meant to be immutable and has been frozen."

sdk_err_1

Anyone can help us on this?

riskpp commented 1 year ago

Hello @aitdigitaltechnology, could you please send us the code of how are you calling MobileMessaging.init and how configuration is provided or you may be you could try to reproduce it using Example application

aitdigitaltechnology commented 1 year ago

Hi @riskpp we follow the guideline to create a new mobile application profile to get the application code, get the FCM key from Firebase appropriately as in the attached screenshot. We managed to receive push notifications on our mobile application successfully, however this error happens during runtime. Here is how we init the MobileMessaging:

const initMobileMessaging = () => {
  if (Platform.OS === 'ios' || !configuration.geofencingEnabled) {
    mobileMessaging.init(
      configuration,
      () => {
        console.log('MobileMessaging started');
        console.log(globalThis.userId)
        mobileMessaging.personalize({ userIdentity: { externalUserId: globalThis.userId?.toString() } }, () => {
          console.log('User saved');
        }, (error) => {
          console.log('User save error', error);
        });
      },
      error => console.log('Mobile messaging error', error),
    );

    mobileMessaging.registerForAndroidRemoteNotifications()
  }

image

riskpp commented 1 year ago

Hi @aitdigitaltechnology where are you setup configuration looks like the error is connected with the way of how you setting it.

aitdigitaltechnology commented 1 year ago

Hi @riskpp the configuration is in the same code with init:

const configuration = {
  applicationCode: "xxxxxxxxxxxxxxxxxxxxx",
  ios: {
    notificationTypes: ['alert', 'badge', 'sound'],
    logging: true,
  },
  defaultMessageStorage: true,
  inAppChatEnabled: true,
  geofencingEnabled: false,
};

Anything wrong here?

riskpp commented 1 year ago

May be try to remove const, the error says that configuration object is immutable.

aitdigitaltechnology commented 1 year ago

Hi @riskpp you are right, no more crashes! thanks a lot!!!

riskpp commented 1 year ago

Great to hear, closing issue then