Ios UIRemoteNotificationType为UIRemoteNotificationTypeNone(如果已全部启用)
在我的应用程序中,我检查用户是否已为我的应用程序启用通知,以启用本地通知,我是这样做的:Ios UIRemoteNotificationType为UIRemoteNotificationTypeNone(如果已全部启用),ios,objective-c,apple-push-notifications,uilocalnotification,Ios,Objective C,Apple Push Notifications,Uilocalnotification,在我的应用程序中,我检查用户是否已为我的应用程序启用通知,以启用本地通知,我是这样做的: UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (types != UIRemoteNotificationTypeNone) { //All enabled } else { //not
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types != UIRemoteNotificationTypeNone)
{
//All enabled
} else {
//not enabled
}
但是我遇到了一个问题,一些用户在iOS设置中都启用了,他们向我发送了一个屏幕截图,这一切都是正确的,但是代码出现在else语句中,好像它都被禁用了。
问题是什么,有人知道我怎么解决吗
谢谢
另一种远程通知类型在ios 5.0之后可用UIRemoteNotificationTypeNewsstandContentAvailability
func isRegisteredForPushNotifications() -> Bool {
if let notificationSettings = application.currentUserNotificationSettings() {
return notificationSettings.types != UIUserNotificationType.None
}
return false
}
我在Swift 2中使用了它,并在iOS9上进行了测试 那么,在这种情况下,类型对这些用户的价值是什么呢?也许他们没有完全启用它。你有完整的代码吗?你注册了通知吗?我不知道什么是值类型,因为它们在另一个国家/地区,我无法将其连接到我的计算机并使用xcode运行,它们会向我发送设置的屏幕截图,并且在本机iOS设置和Swift 3中都已启用?我找不到。无:(
func isRegisteredForPushNotifications() -> Bool {
if let notificationSettings = application.currentUserNotificationSettings() {
return notificationSettings.types != UIUserNotificationType.None
}
return false
}