0

我试图在我的 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的示例应用程序

谁能回答如何解决或如何识别错误的部分?

4

0 回答 0