2015-07-21 26 views
0

當我發送GCM消息並設置了content_available = true標誌時,didReceiveRemoteNotification:callback中的userInfo字典爲空。iOS上的GCM不會發送content_available通知的數據對象

下面是我的UIApplication委託回調:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler { 
    NSLog(@"Notification: %@", userInfo); 
    [[GCMService sharedInstance] appDidReceiveMessage:userInfo]; 
    handler(UIBackgroundFetchResultNoData); 
} 

下面是一個示例捲曲請求工作:

curl --header 'Authorization: key=…' --header 'Content-Type: application/json' -d '{ "registration_ids": ["…"], "data": { "test": "test test test" }}' https://android.googleapis.com/gcm/send 

我得到預期的結果:

Notification: {"collapse_key" = "do_not_collapse"; from = …; test = "test test test";\^J} 

然而,當我添加content_available標誌,以便推送可以在應用程序在後臺工作:

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爲userInfo對象輸出「(null)」。有其他人遇到這個問題,並有一個解決方法?

回答

0

看起來這只是iOS 9 beta 3的一個問題,它在iOS 8.4上正常工作。