我试图在我的iPhone应用程序上实现推送通知。我已成功创建临时配置文件。我尝试使用以下代码读取设备令牌。
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken:\n%@", deviceToken);
viewController.tokenTextField.text = [NSString stringWithFormat:@"%@", deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"didFailToRegisterForRemoteNotificationsWithError:%@", [error localizedDescription]);
viewController.tokenTextField.text = [NSString stringWithFormat:@"Failed to get Device Token: %@", [error localizedDescription]];
}
将错误抛出
didFailToRegisterForRemoteNotificationsWithError:找不到应用程序的有效'aps-environment'权利字符串
之后我清理并重新创建了整个证书,然后再次进行。仍然出现同样的问题。 我也尝试过git hub的示例应用程序 https://github.com/damondanieli/Z2NotifyMe
任何人都可以回复如何解决或如何识别错误的部分?