Question

We have a newsstand app on the store built using Xcode 4. We have noticed that remote notifications are no longer forwarded to our app for devices running iOS 7 when the app is in the background. If the device is in the foreground, the notification is received and handled.

Furthermore, these notifications are processed and handled appropriately on devices running iOS 6 and earlier.

With persistent logging enabled on the device we can see that the iOS 7 device receives the notification however - [UIApplication application: didReceiveRemoteNotification:] is never called.

Assessing the device logs for devices running iOS 5/6/7, we see the remote notification coming in:

Oct 24 11:24:22 iPad-Retina apsd[82] <Warning>: 2013-10-24 11:24:22 +0200 apsd[82]: <APSCourier: 0x14d8c7b0>: Received message for enabled topic 'com.companyname.ourapp' with payload '{
        aps =     {
        "content-available" = 1;
        importantInformation = @"23";
        sound = "";
    };
    }' onInterface: NonCellular  for device token: NO  with priority (null)

On iOS 7 this notification is not forwarded to the app but, on earlier versions of iOS, we see a call to the following method:

Oct 24 11:24:20 Pad2-3G Magic[1328] <Warning>: -[ApplicationDelegate application:didReceiveRemoteNotification:]

and our newsstand notification is processed successfully.

Is there any way we can ensure a successful newsstand download operation for iOS 7 devices using the iOS 6 SDK?

An answer that doesn't involve using Xcode 5 and thus the iOS 7 SDK is preferable at least for now until we do an app redesign.

Thanks in advance

Was it helpful?

Solution

We managed to resolve the issue using the following, assumption:

iOS 7 introduced -application:didReceiveRemoteNotification:fetchCompletionHandler: in the UIApplicationDelegate, we made an assumption that perhaps the reason the notification was not being received was that iOS was testing to see if the application delegate responds to the newer selector.

Naturally Xcode 4 does not have UIBackgroundFetchResult so the method could simply be implemented using an NSUInteger. So we added the method in our application delegate:

- (void)application:(UIApplication *)application 
  didReceiveRemoteNotification:(NSDictionary *)userInfo
  fetchCompletionHandler:(void (^)(NSUInteger result))handler 
{
    [self application:application didReceiveRemoteNotification:userInfo];
    handler(0);
}

Furthermore, we had to add remote-notification to UIBackgroundModes in the application plist.

Building the code using Xcode 4 onto any iOS 7 device successfully resolved the issue and allowed us to submit to the store.

I hope this answer helps anyone else who was in the same position

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top