iOS Simulator APNs Device Token is not received when running in a Mac VM

Starting Xcode 14, iOS Simulator is able to communicate with APNs in order to register for notification in the sandbox environment. I created a sample test for this.

A dumb iOS application that registers for notifications. It has UITests to automatize the tap on the consent popup (it is not possible to ask for the permission via CLI sadly).

Once the application registers, the AppDelegate method didRegisterForRemoteNotificationsWithDeviceToken is called and the device token is sent to a local server application (node.js).

The test itself creates an iOS 18.6 Simulator with xcrun simctl, builds such app and run the tests through through CLI with xcodebuild.

Running this on my personal Macbook Pro M1 2021 goes well every time, so I wanted to bring it on Github Actions (arm64 macOS machines), in order to test the works on a open source library I'm building (hapns).

Contacting Github support led me to test this on a macOS image running inside a VM inside a Veertu Anka container on my personal Macbook Pro, due to an VM architectural limit suspicion.

The results were the same: iOS simulator isn't able to receive the device token. Not even didFailToRegisterForRemoteNotificationsWithError is called (tested through some network probes-requests that communicate to the server which checkpoints the process reached).

So, as asked, I've setup a repro-case to be run in the VM and I've collected VM diagnostics ready to be tested and attached.

Does anyone know if there is some unspecified (or specified but buried in the documentation) limit for this? Thanks.

Github discussion link for further details, repro-case and so on: https://github.com/actions/runner-images/issues/12747

By default Anka VMs have SIP and Firewall disabled. I can reproduce on a vanilla macOS VM using the latest 16.4 Xcode, Simulators etc. I don't see any ~/Library/Logs/CoreSimulator/ logs indicating a problem there.

I've generated a sysdiagnose from the VM right after reproducing the issue which should be helpful for the Apple team: https://drive.google.com/file/d/1tkbnm8bxuJwlAoAU6-0u1_v-LeQpt95D/view?usp=sharing

From gpt-5 with max context after explaining the situation and using the test project's code as context:

APNs registration in iOS Simulator does not reliably work in virtualized macOS (GitHub Actions VMs, Anka, etc.). The simulator’s APNs path depends on host hardware services that aren’t fully available/exposed in VMs, so callbacks may never arrive (neither success nor failure). This matches your observation that it always works on bare metal but never in the VM. Simulator APNs registration does not consistently work in virtualized macOS.

Validate notification UI/delivery in CI without APNs. Use xcrun simctl push to inject a notification payload locally (no device token required). Your permission UI test already handles the prompt.

In any case, this would be worth filing a bug report for so it can be looked at by the relevant teams for clarification or improvements.

Bug Reporting: How and Why? has tips on creating a successful bug report.

Thank you. I've filled the bug report: FB19629940

I've filled the bug report: FB19629940

Thanks.

My colleague and I have been chatting about this and came up with something I’d like you to test:

  1. On macOS 15, install an third-party VM app based on the Virtualization framework. It doesn’t really matter which one.

    I don’t think the exact macOS 15 version matters, but I encourage you to use something reasonable modern, so macOS 15.5 or later.

  2. Using that, create a guest that’s also running macOS 15.

  3. In the guest, sign in to System Settings with an Apple Account. This isn’t strictly necessary, but it’s a good check to make sure that Apple Accounts are working in the guest.

    Note The last time I did this needed to use an Apple Account with two-factor authentication enabled. My standard ‘victim’ account, whose non-2FA status I’ve loving preserved over the years, didn’t work.

  4. Then install Xcode 16.4.

  5. And sign in to Xcode > Settings > Accounts with the same Apple Account.

  6. Finally, use that version of Xcode and its simulator to repeat your test.

Does this work?

This is an interesting test because, even if it doesn’t work, it’ll make good fodder for you bug report. And if it does work then it might be a useful workaround (if not for you, then maybe other folks).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS Simulator APNs Device Token is not received when running in a Mac VM
 
 
Q