4

I want to set a local notification when a remote notification is received and app is in background. This works fine when I have my iPhone 7 device connected to xcode but once I disconnect the device and then put the app in background, local notification does not work and this is because applicationDidReceiveRemoteNotification is not being invoked (I tested it by setting a flag in UserDefaults in the same method which again was not being set). This same procedure when followed on iPhone 6 and 6s works completely fine both when connected and when not connected to xcode. The iOS version on iPhone 7 was 10.2.1 and then updated to 10.3.1 and it didn't work on both of the versions. Thanks.

1 Answers1

2

Got an answer from Apple. This point was the reason of the issue :

Silent push notifications (those whose payloads contain only the content-available key and no alert, badge, or sound keys) are throttled to be delivered only when iOS determines that it’s energy-efficient to do so. Push notifications with user-visible keys such as alert, sound, or badge sent at high priority (priority 10) are always displayed. However, if the notification also contains the content-available key, the notification may be throttled and thus not be sent to the app in the background unless the user taps the notification.

And the important point as the mail says is : The important point is that apps should never be designed expecting that every push notification will be received.