UNNotificationServiceExtension not working on iPho

2019-09-16 23:51发布

问题:

I am not able to intercept push notification via UNNotificationServiceExtension on iPhone 5 running on iOS 10.

The mutable-content flag is set as 1 inside the aps in payload. The same notification is getting intercepted in the extension for iPhone 6S.

Is Notification Service app extension not supported on iPhone5(because of 32-bit maybe)?

I have looked at the documentation and it is no where mentioned that it will work only on specific devices.

Asked the same question in Apple Developer forum as well.

回答1:

Check your deployment target for the extension. it should be same for test device and deployment target. After altering the deployment target to 10.0 the UNNotificationServiceExtension instance called perfectly. May be your iPhone 6S device using 10.1 and match with your UNNotificationServiceExtension deployment target and iPhone 5 using lower version of deployment target. So will not work on iPhone 5.