Start a Project

How to Test Push Notifications in the iOS Simulator?

From Xcode 11.4 and onward we can test push notifications in the simulator. In this blog, we will use the two methods to test the notification.

First, we need to find the simulator identifier on which our application is installed. To find the simulator identifier we will open the terminal and run the below code.

When we execute this code, all the installed simulators with their identifier will show. From here we will find the identifier of our simulator.

Now we will create a JSON file. In this file, we will create valid payload data. And saved it with .apns extension. Put the below code in the file and save it as anyname.apns.

I have saved it as payload.apns

Here, “com.test.webkul” is my project bundle identifer.

We will now trigger the push notification. Simply write the below code in the terminal and execute it.

In this approach, we will simply drag and drop our payload.apns file to the simulator. As soon as we did this we can see a notification on the simulator.

Thanks for reading this blog.

You can also check other blogs from here. if you have any issues or suggestions you can leave your query/suggestion in the comment section.

Exit mobile version