infobip / mobile-messaging-react-native-plugin

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

Getting error on - iOS [UserSessionService] no push registration id. Aborting... #36

Closed agupta-avenir closed 1 year ago

agupta-avenir commented 2 years ago

After upgrading to version 4.0.0 we are getting below on iOS "infobip-mobile-messaging-react-native-plugin": "4.0.0", [UserSessionService] no push registration id. Aborting...

In Infobip Portal, the device is not getting registered now, earlier it was working fine.

kas-kad commented 2 years ago

@agupta-avenir hello please note that the registration gets obtained at undetermined moment of the application lifecycle. After you started MobileMessaging, it requests a Device Token from Apple Push Notification Service - we are unable to control how fast the token would be delivered to the device to accomplish registration process. However we have an event (or notication) that is triggered at the moment the registration completes succesfully: "registrationUpdated", more details in docs https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Library-events. Let us know if any help needed.

agupta-avenir commented 2 years ago

Also, getting below error when calling saveUser method. Any idea about this? mobileMessaging.saveUser( user, user => { console.log("Infobip SaveUser Success: ", user); //alertBox("saveUser", "Inserted data on Success"); }, user => { console.log("Infobip SaveUser Error: ", user); //alertBox("saveUser", "Inserted data error"); }, );

Error: { "description": "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification MMRegistrationUpdated to be notified as the registration succeeded.", "domain": "com.mobile-messaging", "code": 1 }

agupta-avenir commented 2 years ago

Also received this error in iOS. Android is working fine. [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Response received url: https://mobile.infobip.com/mobile/3/version?platformType=APNS status code: 403 headers: [AnyHashable("X-Request-Id"): 1643642291149245875, AnyHashable("Content-Length"): 4, AnyHashable("Access-Control-Allow-Methods"): GET, POST, PUT, PATCH, DELETE, COPY, HEAD, OPTIONS, LINK, UNLINK, PURGE, AnyHashable("Date"): Mon, 31 Jan 2022 15:18:10 GMT, AnyHashable("Strict-Transport-Security"): max-age=31536000; includeSubDomains; preload;, AnyHashable("Content-Type"): application/json;charset=UTF-8, AnyHashable("Server"): SMS API, AnyHashable("Access-Control-Allow-Origin"): *, AnyHashable("Access-Control-Allow-Headers"): Authorization, Content-Type, X-Enrollment-Token, Cache-Control, X-Requested-With, AnyHashable("Vary"): Origin, Access-Control-Request-Method, Access-Control-Request-Headers, AnyHashable("X-Account-Id"): 119107, 119107] data: "null" 2022-01-31 20:48:11:133 [MobileMessaging] ‼️ [VersionManager] An error occurred while trying to validate library version: Error Domain=MobileMessaging.AFError Code=3 "Response status code was unacceptable: 403."

kas-kad commented 2 years ago

Also, getting below error when calling saveUser method. Any idea about this? mobileMessaging.saveUser( user, user => { console.log("Infobip SaveUser Success: ", user); //alertBox("saveUser", "Inserted data on Success"); }, user => { console.log("Infobip SaveUser Error: ", user); //alertBox("saveUser", "Inserted data error"); }, );

Error: { "description": "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification MMRegistrationUpdated to be notified as the registration succeeded.", "domain": "com.mobile-messaging", "code": 1 }

This is essentially the same case that you have reported in the first message.

Also received this error in iOS. Android is working fine. [MobileMessaging] 🛠 [DynamicBaseUrlHTTPSessionManager] Response received url: https://mobile.infobip.com/mobile/3/version?platformType=APNS status code: 403 headers: [AnyHashable("X-Request-Id"): 1643642291149245875, AnyHashable("Content-Length"): 4, AnyHashable("Access-Control-Allow-Methods"): GET, POST, PUT, PATCH, DELETE, COPY, HEAD, OPTIONS, LINK, UNLINK, PURGE, AnyHashable("Date"): Mon, 31 Jan 2022 15:18:10 GMT, AnyHashable("Strict-Transport-Security"): max-age=31536000; includeSubDomains; preload;, AnyHashable("Content-Type"): application/json;charset=UTF-8, AnyHashable("Server"): SMS API, AnyHashable("Access-Control-Allow-Origin"): *, AnyHashable("Access-Control-Allow-Headers"): Authorization, Content-Type, X-Enrollment-Token, Cache-Control, X-Requested-With, AnyHashable("Vary"): Origin, Access-Control-Request-Method, Access-Control-Request-Headers, AnyHashable("X-Account-Id"): 119107, 119107] data: "null" 2022-01-31 20:48:11:133 [MobileMessaging] ‼️ [VersionManager] An error occurred while trying to validate library version: Error Domain=MobileMessaging.AFError Code=3 "Response status code was unacceptable: 403."

you can ignore this error. The VersionManager that triggers this error would be disabled in your Release build. Version Manager just checks whether or not you are using the most up-to-date version of Mobile Messaging.

agupta-avenir commented 2 years ago

Thanks @kas-kad for the Info. Now the issue is i am not able to register users in such case and the Push Notification triggered via the designated method is not working. How can i resolve this. Again, this is happening only on iOS.

kas-kad commented 2 years ago

@agupta-avenir I'm not sure I understand the problem. Could you maybe describe in details what is your use-case.

i am not able to register users

what do you do to register users?

Push Notification triggered via the designated method

how do you trigger push notification?

agupta-avenir commented 2 years ago

@kas-kad After Login, we send some essential parameter(Login Id) in saveUser call and from Infobip portal/Backend we use that Primary Login Id to send push Notification. Now since the saveUser call is failing, the Push Notification are not getting sent.

kas-kad commented 2 years ago

@agupta-avenir you need to wait until registration finishes successfully and call "saveUser" afterwards. I suggest you to subscribe for event/notification called "registrationUpdated" and perform "saveUser" within the event handling code, more details in doc: https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Library-events.

agupta-avenir commented 2 years ago

@kas-kad Already have this "registrationUpdated" event. It's not getting called at all. mobileMessaging.init is success though.

agupta-avenir commented 2 years ago

@kas-kad One more thing In Appdelegate.m we have this line commented out - //[MobileMessagingPluginApplicationDelegate install]; and our Push Notifications are working. What could be the impact of this?

Should i enable it?

kas-kad commented 2 years ago

@agupta-avenir According to our documentation, this line must not be commented out. What was the reason you chose not to follow our guide?

agupta-avenir commented 2 years ago

Thanks @kas-kad , no idea why it was disabled. Now enabled it.

kas-kad commented 2 years ago

@agupta-avenir please doublecheck if you have all the steps done with respect to this guide: https://github.com/infobip/mobile-messaging-react-native-plugin/blob/master/README.md

agupta-avenir commented 2 years ago

Thanks @kas-kad. All other step are good.

Also, we are facing issue in updating the Infobip version to 4.1.6 as on Android we are able to run the App. Can you help on that.

`ERROR Invariant Violation: "appName" has not been registered. This can happen if:

Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project. A module failed to load due to an error and AppRegistry.registerComponent wasn't called.`

kostap13 commented 2 years ago

Hi @agupta-avenir

About Android issue looks like smth related to local environment.

Could you please check what RN and node version do you use?

Requirements for 4.1.6: node (v10.17.0 or higher) React Native (v0.66.3)

agupta-avenir commented 2 years ago

These are the version's currently set, so we need to update to RN version 0.66.3 for v4.1.6 but we tried to update to 4.1.0, 41.2, 4.1.3 got same issue so it's some related to something else. Can you give us minimum requirement for 4.1.3 as that version is having an event we are interested in. Node: v17.0.1 React Native: 0.65.1

tjuric commented 1 year ago

Hi @agupta-avenir, We didn't manage to respond to you in time. Did you manage to update your app with latest RN versions? Is this issue still ongoing?

BR, Tereza

riskpp commented 1 year ago

closing the issue because we didn't receive any response for a long time