Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 27, 2019. It is now read-only.
This repository was archived by the owner on Feb 27, 2019. It is now read-only.

Question about app reinstall in iOS 8 #227

Description

@abellee

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions