Use of undeclared type UNAuthorizationOptions

前端 未结 2 1468
遥遥无期
遥遥无期 2021-02-18 21:12

I am trying to use Firebase to handle push notifications. I have installed Firebase pod (\'Firebase/Core\' and \'FirebaseMessaging\' pods).

And after I impo

相关标签:
2条回答
  • 2021-02-18 21:30

    you need to import UserNotifications before calling those framework. And what Nirav D said is true, it is a new framework in iOS 10, should also remember to select the correct deployment target.

    0 讨论(0)
  • 2021-02-18 21:50

    UserNotifications.framework is available from iOS 10 and you are working with Xcode 7.3 means with iOS 9 and lower, So there is no need for you to add that if #available(iOS 10.0, *) {, write only else part directly and register remote notifications.

    let settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
    application.registerUserNotificationSettings(settings)
    application.registerForRemoteNotifications()
    
    0 讨论(0)
提交回复
热议问题