I want to test push notification on iOS. I have no real device. How can I test this with iOS simulator? If you have any solution, please help me.
-
1You can't do it – Anton Belousov Mar 05 '20 at 19:21
-
1Does this answer your question? [How can I test Apple Push Notification Service without an iPhone?](https://stackoverflow.com/questions/1080556/how-can-i-test-apple-push-notification-service-without-an-iphone) – Titouan Mar 05 '20 at 19:26
1 Answers
You must have to use a real device to test if push notifications are working or not since push notifications aren’t supported in Xcode’s iOS Simulator.
Xcode 11.4 beta is out and the best part about this release for me is that we can finally test push notifications in the iOS Simulator!
“Simulator supports simulating remote push notifications, including background content fetch notifications. In Simulator, drag and drop an APNs file onto the target simulator. The file must be a JSON file with a valid Apple Push Notification Service payload, including the “aps” key. It must also contain a top-level “Simulator Target Bundle” with a string value matching the target application‘s bundle identifier. simctl also supports sending simulated push notifications. If the file contains “Simulator Target Bundle” the bundle identifier is not required, otherwise you must provide it as an argument (8164566):
$ xcrun simctl push <device> com.example.my-app ExamplePush.apns"

- 2,496
- 4
- 24
- 48