Is it possible to intercept push notifications for

2020-02-02 03:37发布

问题:

I'd like to act on remote push notifications that are meant for another app in an app that I am writing. Is this possible?

回答1:

This is not possible on iOS.

A device token is assigned to an installation of an app upon registering to receive push notifications. Push notifications are sent using these tokens as an identifier of the recipient. iOS will then deliver the notification to the app that was assigned that particular device token.

The only way to bypass this would be to do some low-level network interception using private APIs, which would most likely only give you an encrypted version of the APNS payload.