Sending Push Notifications to the iOS Simulator
Xcode 11.4 beta 1 surprised us last week with a long awaited feature: push notifications on the simulator! (standing ovation).
As anyone that ever had to debug push notifications on iOS knows, the process (depending on your backend implementation) is a bit of a hassle. Starting from the fact that a custom back end implementation might not have an easy way of sending push notifications in development/testing/staging environment, to the fact that you need an actual device to receive those notifications on. And as anyone who ever had to work with manual provisioning knows, that might come with it’s own set of headaches.
But problems no more! Both actual issues have been corrected with the latest beta release. You don’t actually need to send them from your backend and you don’t need a physical device anymore.
At this point you’re thinking “Yay! There’s probably a hidden submenu somewhere in the simulator toolbar”, but think again. If we’re used to Simulate Location or Simulate Memory Warning , this is not so straightforward.
For this, we actually need to use xcrun. If that’s something that’s new to you, let’s take a look at the man description:
xcrun provides a means to locate or invoke coexistence- and platform-
aware developer tools from the command-line, without requiring users to
modify makefiles or otherwise take inconvenient measures to support mul-
tiple Xcode tool chains.
The tool xcode-select is used to…