我在其中一个应用程序中使用通知,当应用程序处于活动状态时收到通知,我处理数据并且一切正常,但应用程序处于未处理状态时我没有收到任何通知背景或遇难。有什么问题可以帮助我吗?当应用程序在后台时未收到UINotification ios
谢谢!
这是我做的,到目前为止
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
tokenstring = [[NSString alloc] initWithFormat:@"%@",deviceToken];
tokenstring = [tokenstring stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
tokenstring = [[NSString alloc]initWithFormat:@"%@",[tokenstring stringByReplacingOccurrencesOfString:@" " withString:@""]];
NSLog(@"TokeinID:>> %@",tokenstring);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"didReceiveRemoteNotification: %@",userInfo);
AudioServicesPlaySystemSound(1002);
//Some code or logic
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
NSLog(@"didFailToRegisterForRemoteNotificationsWithError: %@",err.description);
}
什么有效载荷时,设备接收推送通知你好吗? –
如果您的应用程序在后台,并且通知已到,它会在通知中心显示,当用户点击该通知时,会调用didReceiveRemoteNotification方法。 –
嗨阿曼有问题的有效载荷,谢谢大家 – user3295961