gpt4 book ai didi

ios - 如何推迟【权限请求提醒】?

转载 作者:行者123 更新时间:2023-11-28 08:24:21 24 4
gpt4 key购买 nike

我的应用需要这些权限

  • 通知
  • 全局定位系统
  • 照片

当用户打开图库时请求照片权限,但前两个权限显示应用程序启动,我可以将 GPS 作为第一个请求权限,但我想将通知对话框推迟到另一个屏幕,如何做到这一点?

这个library似乎不允许这样做有什么建议吗?

let notificationTypes : UIUserNotificationType = [UIUserNotificationType.Alert,UIUserNotificationType.Badge,UIUserNotificationType.Sound]
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)

application.registerForRemoteNotifications()
application.registerUserNotificationSettings(notificationSettings)

最佳答案

谢谢,这为我解决了,...

从应用委托(delegate)调用

    let notificationTypes : UIUserNotificationType = [UIUserNotificationType.Alert,UIUserNotificationType.Badge,UIUserNotificationType.Sound]
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(notificationSettings)

从另一个类调用

    let notificationTypes : UIUserNotificationType = [UIUserNotificationType.Alert,UIUserNotificationType.Badge,UIUserNotificationType.Sound]
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
UIApplication.sharedApplication().registerForRemoteNotifications()
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)

关于ios - 如何推迟【权限请求提醒】?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40487318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com