我们可以更改Permission seek方法的默认行为(它在我们启动应用程序时出现)但是我希望在用户注册时显示它,我在appDelegate中执行此操作:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
return true
}
答案 0 :(得分:4)
您可以将它放在您想要询问用户的不同类别中,如下所示
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)