iOS 10: push notifications don't call delegate method consistently

Originator:bcriscuolo
Number:rdar://27822963 Date Originated:08/12/16
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 10 beta 5 (14A5335b)
Classification: Reproducible:Always
 
Summary:
Our push notification SDK is being enhanced to support iOS 10's UserNotification.framework. We are confident in the solution you've provided and look forward to its simplicity.

However, we also must design our library for backwards compatibility, in two ways:
- allow library to be included in an application built with Xcode 7, with a minimum deployment target of iOS 8 (until Apple prevents submissions from Xcode 7)
- allow library to be included in an application build with Xcode 8, but with deprecated (old style UIApplication) notification registration.

We believe we have identified an issue with the second case, with the application running on iOS 10 b4 on an iPod touch.

If 

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler

is implemented, but NOT 

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

-application:didReceiveRemoteNotification:fetchCompletionHandler: will NOT be called when a notification is received while the app is in the background.

This is contrary to documentation, and contrary to the *same* project (Xcode 8 b5, etc.) running on an iOS 9.3 device.

Because of this, behavior of a "legacy" app (albeit using deprecated methods) will find an issue in handling push notification payloads properly, as the delegate expected to be called in the background never is.

Furthermore, tapping on the notification (and bringing the app to the foreground) does NOT trigger the delegate method either, meaning that the notification is essentially unhanded.

A sample project has been attached; while this implements the entirety of our SDK please focus on the code in AppDelegate+ETPush.m.

To test this, we've used Pusher to send payloads directly to the device, as well as via the larger system having generated payloads via Salesforce Marketing Cloud's push interface.

Steps to Reproduce:
-Using Xcode 8 b5:
-Using device with iOS 10 b5

1. Open the "MarketingCloud.xcodeproj" in the attached directory
2. Configure signing for push notifications for your specific configuration
3. Run the MarketingCloud target on your device
4. Look for log messages which say "******** Device Token registered:" and extract your device token
5. Place a breakpoint in -application:didReceiveRemoteNotification:fetchCompletionHandler:
6. With app in foreground, send a push notification. Confirm breakpoint is hit.
7. Switch app to background, send a push notification. Confirm breakpoint is hit.


Expected Results:
Both breakpoints will be hit.

Actual Results:
With app in background, breakpoint is not hit - meaning that -application:didReceiveRemoteNotification:fetchCompletionHandler: is never called.

Version:
iOS 10 beta 5 (14A5335b)

Notes:
Seems similar, in a strange way (delegate confusion?) to rdar://27194349 (http://www.openradar.me/radar?id=5587160786796544).

Please let me know how I can help on this.

Configuration:
iPod touch 6th generation, WiFi

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!