iosobjective-csilent-notification

Error in Silent notification display banner in Objective c iOS 11


I am implementing Silent notification in Objective c Code in ios 11. Using FCM Notification by adding this method. 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);
}

and paylod is :

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

didReceiveRemoteNotification method call when notification recived But my question is why banner is visible when silent notification receive. How to restrict notification banner.


Solution

  • Remove extra keys from aps array and payload should be like this.

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