我一直在开发环境中测试推送通知,并且它们工作得很好。也就是说,我的应用已通过TestFlight批准,现在我需要内部测试人员才能接收通知。在设置适当的生产证书和.pem文件后,我的用户仍未收到通知。经过研究后,似乎是因为我的代码仍在获取开发设备令牌,而不是生产设备令牌?
如何更改代码以获取设备令牌的生产版本?
AppDelegate.m
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
NSString *noteDataString = [NSString stringWithFormat:@"%@", deviceToken];
noteDataString = [noteDataString stringByReplacingOccurrencesOfString:@" " withString:@""];
noteDataString = [noteDataString stringByReplacingOccurrencesOfString:@">" withString:@""];
noteDataString = [noteDataString stringByReplacingOccurrencesOfString:@"<" withString:@""];
deviceID = noteDataString;
}