You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.
I read about your code, and found you have set UserDefaults to record the app whether requested, just like the Notification.
But in iOS 8, if users denied the Notification, system will remember the setting, then if the user uninstall the app and reinstall it, the requested record is definitely false, but the types of UIApplication.shared.currentUserNotificationSettings is definitely not equals to the UIUserNotificationType(),
so the logic will goes to the unknow,
I should call the first time Notification request here, right?
but I think the request alert will not appear, isn't it?
I did the testing like this:
if let types = UIApplication.shared.currentUserNotificationSettings?.types, types != UIUserNotificationType() {
Log.verbose("authorized");
}else{
if let bool = UserDefaults.standard.value(forKey: "test") as? Bool {
if bool {
Log.verbose("unauthorized");
}else{
let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil);
UIApplication.shared.registerUserNotificationSettings(settings);
Log.verbose("unknown");
}
}
}
just like what I said, the request alert is not appear after I reinstall the app if I denied before,
iOS 8.1 ~ 8.4 simulator are all not working.
so I think whether should to keep the requested record in KeyChain if iOS 8.1~8.4,
otherwise keep it in UserDefaults?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I read about your code, and found you have set
UserDefaults
to record the app whether requested, just like theNotification
.But in iOS 8, if users denied the
Notification
, system will remember the setting, then if the user uninstall the app and reinstall it, therequested
record is definitelyfalse
, but thetypes
ofUIApplication.shared.currentUserNotificationSettings
is definitely not equals to theUIUserNotificationType()
,so the logic will goes to the
unknow
,I should call the first time
Notification
request here, right?but I think the request alert will not appear, isn't it?
I did the testing like this:
if let types = UIApplication.shared.currentUserNotificationSettings?.types, types != UIUserNotificationType() {
Log.verbose("authorized");
}else{
if let bool = UserDefaults.standard.value(forKey: "test") as? Bool {
if bool {
Log.verbose("unauthorized");
}else{
let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil);
UIApplication.shared.registerUserNotificationSettings(settings);
Log.verbose("unknown");
}
}
}
just like what I said, the request alert is not appear after I reinstall the app if I denied before,
iOS 8.1 ~ 8.4 simulator are all not working.
so I think whether should to keep the
requested
record inKeyChain
if iOS 8.1~8.4,otherwise keep it in
UserDefaults
?The text was updated successfully, but these errors were encountered: