Reputation: 246
When I send a GCM message with the content_available=true flag set, the userInfo dictionary in the didReceiveRemoteNotification: callback is null.
Here's the callback in my UIApplication delegate:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler {
NSLog(@"Notification: %@", userInfo);
[[GCMService sharedInstance] appDidReceiveMessage:userInfo];
handler(UIBackgroundFetchResultNoData);
}
Here's a sample CURL request that works:
curl --header 'Authorization: key=…' --header 'Content-Type: application/json' -d '{ "registration_ids": ["…"], "data": { "test": "test test test" }}' https://android.googleapis.com/gcm/send
I get the expected result:
Notification: {"collapse_key" = "do_not_collapse"; from = …; test = "test test test";\^J}
However, when I add the content_available flag so the push can work while the app is in the background:
curl --header 'Authorization: key=…' --header 'Content-Type: application/json' -d '{ "registration_ids": ["…"], "data": { "test": "test test test" }, "content_available": true}' https://android.googleapis.com/gcm/send
NSLog outputs "(null)" for the userInfo object. Has anyone else run into this issue and have a workaround?
Upvotes: 0
Views: 286
Reputation: 246
Looks like this was just a problem with iOS 9 beta 3, it works correctly on iOS 8.4.
Upvotes: 0