[英]iOS Google Cloud Messaging payload
這是我第一次圍繞推送通知進行操作。 我已經在iOS上實現了GCM,並且一切正常。 但是我的問題是我無法為我的應用創建良好的有效負載。 我正在使用郵遞員發送推送通知。 這是我的內容:
{
"registration_ids":["1234"],
"data": {"aps":{"alert":"Hello, world!","sound":"default", "content-available":"1"}}
}
問題是我的userInfo獲取“ aps”的字典:
如何正確發送消息。 我的userInfo沒有這樣的“內容可用”,因此未調用我的(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler
。 如何正確測試呢?
你做錯了。 如果您閱讀了服務器文檔 ,將會發現您需要為此使用“通知負載支持”。
所以你的內容應該像
{
"registration_ids" : ["1234"],
"notification" : {
"title" : "Hello, world!",
"sound" : "default",
},
"content_available" : 1,
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.