I encountered a problem with PushNotificationIOS using React Native. After I updated RN from 0.48 to 0.54 and upgraded my iPhone with iOS 11.3, my iOS app can receive push message but without sound. The notification part of the code was left untouched and there was no problem with message sound. Just wonder what configuration might need to be made to make the message sound normal. Thanks for your suggestions.
I check the notification object in debugging mode and it got alert title, body, and should value and looks good.
componentWillMount() {
PushNotificationIOS.addEventListener("register", this._onRegistered);
PushNotificationIOS.addEventListener(
"registrationError",
this._onRegistrationError
);
PushNotificationIOS.addEventListener(
"notification",
this._onRemoteNotification
);
PushNotificationIOS.addEventListener(
"localNotification",
this._onLocalNotification
);
}
....
_onRegistered(deviceToken) {
if (deviceToken)
...
console.log("Registered deviceToken=" + deviceToken);
}
_onRemoteNotification(notification) {
notification.finish(PushNotificationIOS.FetchResult.NoData);
var body = notification.getMessage().body.split("|");
if (body.length === 1)
Warn(
notification.getMessage().title, //message only.
body[0],
[{ text: "OK", onPress: null }]
);
else if (body.length === 2) {
//code + message
Warn(notification.getMessage().title, body[0] + "\n" + body[1], [
{ text: "OK", onPress: null }
]);
store.dispatch(sessionActionCreators.updateConfirmCode(body[0]));
}
}