Since Xcode 11, iOS simulators can now receive push notifications. This can be accomplished by executing a specific command or providing a JSON file to the simulator. I got this information from this blog: Test Notification on Simulator.
However, in my use case, I use Firebase Cloud Messaging to deliver notifications to the user of my app (Android and iOS both). I am unable to test the notification generated by Firebase on a simulator as the payload is different for FCM.
Is there a way to achieve this?
I found a similar question on the topic but there's no answer on it so far.
For Testing push notifiction in simulator just creat a new file and paste following json object and save file in .apns , and then just drag and drop this file in simulator then push will work.
{
"aps" : {
"alert" : {
"title" : "sarunw.com",
"body" : "A asdfsadfsadf"
},
"badge" : 5
},
"Simulator Target Bundle": "bundleId"
}
For differenct payload just use following JSON object in Postman
{
"to" : "ewebWDSSwYc:APA91bGOARO4eq9LlOfgfXPQZMK3IiRFanhzSSgkD6cVqJiPbnyuEgsvQMarDEl6Hg7_UMtFM6Hn90jyTsSENNqLNNLVjLSypR0voAO3j6orIsgabX-t0cpfJ0qpB2SzhZiXvor0r__d",
"notification":
{
"title":"ABC",
"body":"123",
"mutable_content" : true,
"category":"CustomSamplePush"
},
"data":
{
"sender_contact_code" : "+92",
"sender_contact" : "(555) 564-8583",
"group_name":"Testing Group",
"type":"NewMessage",
"type_id":"1213",
"notification_type_id":"123213"
}
}
with this url -> https://fcm.googleapis.com/fcm/send (Type will be POST)and in authorization you need to put Server key in Key Value, in that way you will be able to send push notification with your own formatted object.
also you can use Pusher for testing push notifiction & I have uploaded screenshot for reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With