FCM Messaging in Swift
FCM : https://firebase.google.com/docs/cloud-messaging/ios/client
Initialize FCM in Swift
follow below step to add FCM in your swift Project
1- If you don't have an Xcode project yet, create one now.
Create a Podfile if you don't have one:
$ cd your-project directory
$ pod init
2- Add the pods that you want to install. You can include a Pod in your Podfile like this:
3- Install the pods and open the .xcworkspace file to see the project in Xcode.
$ pod install
$ open your-project.xcworkspace
4- Download a GoogleService-Info.plist file from plist and include it in your app.
5- Upload APNs certificate to Firebase. APN Cert
6- add "import Firebase" in your appDelegate file of project
7- add this "FIRApp.configure()" in your "application:didFinishLaunchingWithOptions"
8- register for remote notification
9- to get register token use
10- and if u want monitor for token change use below code in appDelegate file
11- to recieve message from fcm add below code in appDelegate
12- and for disconnect use
in your appDelegate.
the initialization complete and client ready to recieve message from fcm panel or send by token from third party server
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0