我正在测试使用推送通知的应用,并在我的入职流程中要求获得标准批准。我遇到了麻烦,因为我要求批准,单击“批准”,然后进入“设置”以查看应用程序的“通知”设置为“关闭”。如果我再次通过入门,它将重新询问,我可以批准,它仍将是“关闭”。在我调试的每个安装中似乎都没有发生这种情况,但这里有一些原因。我可以在中间删除应用程序但它并不总是有帮助,但我无法确定导致它的原因。
// on a page describing push messaging in the app, clicking continue button prompts for approval and goes to next view
// it's okay if the transition happens before approving, as the prompt stays above until you approve/deny no matter what
-(IBAction)enablePushBtnClick:(id)sender {
// attempt to register for push notifications (app supports ios >= 8 only)
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
[self continueViews];
}