jesus
jesus

Reputation: 21

firebase notification cordova ios integration

I'm trying to add firebase notifications on cordova app ios but i can't. This are the steps i've done:

1-created the firebase project
2-copy the configuration file Googleservice-info.plist
3-install cordova plugin fcm
4-add this code in file index.js

window.FirebasePlugin.grantPermission();


    FCMPlugin.onNotification(function(data){
        if(data.wasTapped){
          //Notification was received on device tray and tapped by the user.
          console.log( JSON.stringify(data) );
        }else{
          //Notification was received in foreground. Maybe the user needs to be notified.
          console.log( JSON.stringify(data) );
        }
    });

    FCMPlugin.subscribeToTopic(topicSub);

5-installed cocoapods 6-executed this command:

pod init

7-in file PodFile i've inserted this code:

pod ’Firebase/Core’

pod 'Firebase/Messaging'

8-installed pod with this comand:

pod install

10-open the project with .xcworkspace file
Now xcode return me this errors:

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

What's wrong?

Upvotes: 2

Views: 1103

Answers (2)

Mamta Chaudhari
Mamta Chaudhari

Reputation: 9

Run below code to update:

step1: pod repo update

step2: pod install

This may work.

Upvotes: 0

Hernan Humaña
Hernan Humaña

Reputation: 433

hey you need install this:

cordova plugin add cordova-plugin-cocoapod-support --save

This work for me.

Upvotes: 2

Related Questions