【问题标题】:Error in Silent notification display banner in Objective c iOS 11Objective c iOS 11中的静默通知显示横幅错误
【发布时间】:2018-12-07 00:58:42
【问题描述】:

我正在 ios 11 的 Objective c 代码中实现静默通知。通过添加此方法使用 FCM 通知。 What is Silent Push Notification? When does the device receive it?

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{

   //Success
    handler(UIBackgroundFetchResultNewData);
}

而paylod是:

    {
    "aps" = {
        "content-available" : 1,
        "sound" : ""
    };
    // You can add custom key-value pair here...
}

didReceiveRemoteNotification 收到通知时调用方法但我的问题是为什么收到无提示通知时横幅可见。如何限制通知横幅。

【问题讨论】:

标签: ios objective-c silent-notification


【解决方案1】:

从 aps 数组中移除多余的键,payload 应该是这样的。

"aps" = {
    "content-available" : 1
};

【讨论】:

    【解决方案2】:

    我对此进行了研发。最后我得到了 youtube https://www.youtube.com/watch?v=Xde7ns5w9LM 的链接。我从有效载荷中删除额外的密钥,如警报标题等,只需添加以下内容并解决问题。

    "aps" = {
        "content-available" : 1,
        "sound" : ""
    };
    

    【讨论】:

      猜你喜欢
      • 2013-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-07
      • 1970-01-01
      • 1970-01-01
      • 2018-06-07
      • 1970-01-01
      相关资源
      最近更新 更多