didReceiveRemoteNotification:fetchCompletionHandler not being called when app is in background and not connected to Xcode

前端 未结 10 1673
别那么骄傲
别那么骄傲 2020-11-28 04:27

I\'ve a very strange problem, I implemented:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchComp         


        
10条回答
  •  一生所求
    2020-11-28 05:05

    There could be number of things might have gone wrong, The first from my own experience. In order to make silent push notification work. Your payload has to be structured correctly,

    {
        "aps" : {
            "content-available" : 1
        },
        "data-id" : 345
    }
    

    Does your push message has content-available: 1 if not then iOS will not call the new delegate method.

    - (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
    

提交回复
热议问题