3

I'm trying to implement push notification by using Firebase. I have installed the 'Firebase/Core' and 'Firebase/Messaging' frameworks using cocapod. I'm able to import FirebaseInstanceID & FirebaseMessaging in the File. But for "import UserNotifications" it says "No Such Module". I'm using Swift 2.1.1 and Xcode 7.3.1 and my targeted iOS is 8.1+ ... Kindly Help, thanks in advance .

Aaliya
  • 85
  • 2
  • 10

2 Answers2

1

Upgrading to XCode 8 is probably the best option.

But if you can't or don't want to upgrade for some reason you can use old way of APN Registration (without importing UserNotifications):

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

Firebase Messaging will work, but some new iOS10 features might not function.

Vitalii
  • 4,267
  • 1
  • 40
  • 45
0

UserNotification is available from iOS 10 and later. Xcode 7.3.1 support upto iOS 9 only. If you need to use this framework. You need to update to latest Xcode(obviously Xcode8) which supports iOS 10.

Arasuvel
  • 2,971
  • 1
  • 25
  • 40