How to Test push notification in IOS simulators using Xcode 11.4 and above without using an ios device.
Xcode 11.4 and above support testing of push notifications using simulators.
To test,
Controlroom is an amazing app which i came across recently which allows to control the simulators. It provides a nice UI to customise the notifications. Special thanks to Paul Hudson for sharing the source code in git. Git URL - https://github.com/twostraws/ControlRoom
run the following command in the terminal
xcrun simctl push <simulator identifier> <bundle identifier of the app> <pushcontentfile>.apns"
Xcode Menu => Window => Devices and Simulators
{
"aps": {
"alert": "Push Notifications Test",
"sound": "default",
"badge": 1
}
}
The .apns file should contain the bundle identifier of the app as a part of the payload
{
"Simulator Target Bundle": "<bundle identifier of the app>",
"aps": {
"alert": "Push Notifications Test",
"sound": "default",
"badge": 1
}
}