OneSignal Notifications on iOS Simulator
Apple now allows to send mock notifications to the iOS Simulator.
Unlike the Android Emulator where you test notifications from your OneSignal
Dashboard, on iOS you can only simulate them locally. To send a push
notification to Simulator, you have to first create file with .apns
extension.
This file can be sent by following command.
However, OneSignal uses custom format for notification payload like deeplink. To be more complicated, each notification requires a unique ID. Multiple notifications with same ID will not work properly.
You can use following shell script to generate notification's UUID, inject it into notification payload and trigger send to your Simulator.
Copy this content into file named send-push.sh
. You will need to customize
bundle (com.example
) and Simulator name (iPhone 13
).
Shell script can be run using following commands.