I'm trying to use the Firebase Cloud Messaging (FCM) SDK to send push notification to iOS devices. I created a very simple application which has an empty ViewController and an AppDelegate copied by that provided in the quick start iOS project.
I followed all the instructions provided in the guide:
Installed SDK using pod, here is my podFile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'fcmPushTest' do
# Comment the next line if you're not using Swift and don't want to use
dynamic frameworks
use_frameworks!
# Pods for fcmPushTest
end
- Added the push notification in the "Capabilities" Tab in Xcode
- Generated APNs authentication key and APPID (the APPID was automatically generated by Xcode) on the apple developer portal
- Created a new project for my application in the Firebase developer console, downloading and copying the GoogleService-Info.plist file in the root directory of the project
- Uploaded the APNs authentication key in the Firebase developer console
- Installed the app and put it in background (notifications do not appear when app is in foreground)
When the application starts, it correctly returns an FCM token. Then I use this token in the FCM push notification console in order to send a message but nothing happens: notification is not received even if the console says that the message has been "completed"
Trying to send the notification with curl
curl -X POST --header "Authorization: key=<API_ACCESS_KEY>" \
--Header "Content-Type: application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{\"to\":\"<YOUR_DEVICE_ID_TOKEN>\",\"notification\":{\"body\":\"Yellow\"},\"priority\":10}"
I obtain the following response:
{"multicast_id":7144776975498650143,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1510221288971805%7fe9e2a37fe9e2a3"}]}
Since success is equal to 1 i guess that all is ok but I still get no notifications.
I googled for a possibile cause of the problem but it seems that Firebase Messaging Libraries have been recently changed (pod says I'm using the FirebaseMessaging 2.0.3 version) so i can't find a proper solution.