我只是想知道是否可以在询问推送通知权限警报时进行自定义。我们希望有一个更明确的提示,而不是询问应用程序启动的那一刻。 据我所知,QB框架迫使应用程序启动时询问它,我们无法对其进行修改。
那么可以自定义iOS的推送通知权限提醒时间吗?
谢谢
答案 0 :(得分:1)
调用方法
时会出现此提示#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
}
#else
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
#endif
将此方法放在需要显示提示的位置。