未收到iOS推送通知
后端-Django 前端-目标C(X代码) 我已经按照Apple文档配置推送通知,并成功完成了所有步骤 对于后端,我使用with Django==1.7,在发送消息时不会导致任何错误 对于前端,我添加了以下行以接收通知未收到iOS推送通知,ios,django,push-notification,Ios,Django,Push Notification,后端-Django 前端-目标C(X代码) 我已经按照Apple文档配置推送通知,并成功完成了所有步骤 对于后端,我使用with Django==1.7,在发送消息时不会导致任何错误 对于前端,我添加了以下行以接收通知 UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUse
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"]];
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"content---%@", token);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"DeviceToken!!!" message:token delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
....
}
UIUserNotificationType userNotificationTypes=(UIUserNotificationTypeAlert|
UIUserNotificationTypeBadge|
UIUserNotificationTypeSound);
UIUserNotificationSettings*设置=[UIUserNotificationSettings设置类型:userNotificationTypes
类别:无;;
[应用程序注册表通知设置:设置];
[申请登记处证明];
-(无效)应用程序:(UIApplication*)应用程序DIdRegisterForRemotionTificationswithDeviceToken:(NSData*)deviceToken
{
NSString*标记=[[deviceToken description]stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@”“];
token=[token StringByReplacingOfString:@“with String:@]”的发生率;
NSLog(@“内容-%@”,令牌);
UIAlertView*alert=[[UIAlertView alloc]initWithTitle:@“DeviceToken!!!”消息:令牌委托:自取消按钮:@“取消”其他按钮:nil];
[警报显示];
}
-(无效)应用程序:(UIApplication*)应用程序DidReceiveMemotentification:(NSDictionary*)用户信息{
....
}
但在此之后,我无法收到通知。我是否正确完成并配置了步骤?我的X代码版本是6.3,苹果设备的iOS版本是8.4。两者是否都应该是兼容版本才能接收通知
有没有办法在APNs云上记录或查看进度 直接使用deviceToken
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
NSLog(@"My token is: %@", deviceToken);
}
此外,您还需要确保正在发送推送通知
尝试使用他们的应用程序,它将帮助您确保正确发送推送,并且您需要修复前端
如果一切正常,请尝试删除现有版本,重新启动手机并安装新版本,然后重试。检查您的ck.pem文件可能是这些文件导致问题尝试此教程:@johnykumar tutorial is may'13。那还有效吗?@suthar我很确定它是有效的。是的,当然里面没有无效的东西。没有任何东西是不可预测的。问题在于版本。iOS是8.4,Xcode与iOS版本不兼容。更新Xcode解决了这个问题。谢谢