(Q) Local Push Notification error in IOS 11

Hello,

When I copied the example of local push notification with iOS section and then run it, I got an error.
The error is ‘Must specify either an alert title, or message, or both’.
https://docs.expo.io/versions/latest/sdk/notifications.html

I don’t know why this error occurred.
In reference, I am using latest Expo v22.0.0 and test it on iPhone 6 device based on iOS 11.

Please help me. Thanks in advance!

Jinho

1 Like

hey, based on the link you gave, you’re trying to do the local notifications example, which are different from push notifications. Its a bit confusing figuring out the difference but essentially local notifications are created from code in the app and don’t need to communicate with your server, while push notifications are sent from your server and don’t need an app update to be sent.

in reference to your problem with the example, i’m not sure why it errored out but I do know some of the sample code in that example is wrong. the part with the alert is trying to set the title and body to values of notification.title and notification.body, which are undefined values in the callback function. I’ve created an example that should work, with correct parameters and you can use that as a base for other local notifications you want to create.

3 Likes

Hi, samee! Thanks for your help!

Jinho

3 Likes