google cloud messaging - GCM on iOS doesn't send data object for content_available notifications -
when send gcm message content_available=true flag set, userinfo dictionary in didreceiveremotenotification: callback null.
here's callback in uiapplication delegate:
- (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo fetchcompletionhandler:(void (^)(uibackgroundfetchresult))handler { nslog(@"notification: %@", userinfo); [[gcmservice sharedinstance] appdidreceivemessage:userinfo]; handler(uibackgroundfetchresultnodata); }
here's sample curl request 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 expected result:
notification: {"collapse_key" = "do_not_collapse"; = …; test = "test test test";\^j}
however, when add content_available flag push can work while app in 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)" userinfo object. has else run issue , have workaround?
looks problem ios 9 beta 3, works correctly on ios 8.4.
Comments
Post a Comment