18

I'm facing a strange issue during integration of the Firebase Notification new API in my iOS Swift App. I encounter some difficulties receiving a push Notification sent from the Firebase web plateform. My certificate is OK since I tested it with a quick PHP script to send a test notification to my phone.

In this post : https://stackoverflow.com/a/37467793/5082848 , it is said to add in AppDelegate

func applicationDidBecomeActive(application: UIApplication) {
    FIRMessaging.messaging().connectWithCompletion { error in
        print(error)
    }
}

However, FIRMessaging is unknown, whereas my podfile correctly contains Firebase/Messaging . Here is what the terminal returns after pod install :

Using Firebase (3.3.0)

Using FirebaseAnalytics (3.2.1)

Using FirebaseInstanceID (1.0.7)

Using GoogleInterchangeUtilities (1.2.1)

Using GoogleSymbolUtilities (1.1.1)

Using GoogleUtilities (1.3.1)

Do you have any clue please ? Thanks a lot

Community
  • 1
  • 1
GrayFox
  • 824
  • 2
  • 10
  • 27

6 Answers6

32

You should import FirebaseMessaging

import FirebaseMessaging
t4nhpt
  • 5,264
  • 4
  • 34
  • 43
  • Hi ! Thanks but I tried to have a look into imports but there is no FirebaseMessaging ... I only have Firebase, FirebaseStorage, FirebaseAuth – GrayFox Jul 08 '16 at 12:01
25

Downgrading from 3.3 to 3.2 fixed the problem for me. To get the messenger library you have to install it's pod separately.

pod 'Firebase/Messaging' 
Saif Jamil Khan
  • 245
  • 2
  • 3
20

Open your podfile

  1. add : pod 'Firebase/Messaging'

  2. install/update the pod

  3. add: import FirebaseMessaging in your AppDelegate

It worked for me.

goto
  • 7,908
  • 10
  • 48
  • 58
yasir khan
  • 419
  • 4
  • 6
1

Okay then,

It seems to be a bad pod install since I tried to create from an all new project with the same podfile and I had many new return lines including : Installing FirebaseMessaging (1.1.0)

I'll try to uninstall all pods and reinstall

GrayFox
  • 824
  • 2
  • 10
  • 27
1

Add this at the top

import Firebase
1

Open your project/ ProjectNavigator/Pods.xcodeproj/Targets and check if there is a FirebaseMessaging in your pods list. If not open Pods file and add "pod 'Firebase/Messaging' " and run "pod install" into the terminal.