Slient推送通知无法进入iOS

时间:2017-05-31 09:13:21

标签: ios objective-c silent-notification

我正在尝试很多但尚未成功在应用程序被杀死状态时获得无声通知

这是我正在尝试的代码..

APS数据:

Failed to resolve: android.arch.lifecycle:extensions:1.0.0-alpha1

2 个答案:

答案 0 :(得分:2)

在有效负载的aps词典中,不得包含提醒,声音或徽章键。

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

请试一试。

答案 1 :(得分:0)

您应该在AppDelegate.m

中实施
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
    NSDictionary *aps = [userInfo objectForKey:@"aps"];
    NSLog(@"hello");
    NSLog(@"userinfo---->>>>%@",userInfo);
    [UIApplication sharedApplication].applicationIconBadgeNumber=[[aps objectForKey:@"badge"] integerValue];
    [self application:application didReceiveRemoteNotification:userInfo];
}