[英]firebase notification cordova ios integration
我正在嘗試在cordova app ios上添加firebase通知,但我不能。 這是我已經完成的步驟:
1-創建了firebase項目
2-復制配置文件Googleservice-info.plist
3-安裝cordova插件fcm
4-在文件 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 安裝了 cocoapods 6 執行此命令:
pod init
7-in 文件 PodFile 我插入了這個代碼:
pod ’Firebase/Core’
pod 'Firebase/Messaging'
使用此命令安裝 8 個 pod:
pod install
10-用 .xcworkspace 文件打開項目
現在 xcode 返回給我這個錯誤:
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.
怎么了?
嘿你需要安裝這個:
cordova plugin add cordova-plugin-cocoapod-support --save
這對我有用。
運行以下代碼進行更新:
步驟1:pod repo更新
步驟 2:pod 安裝
這可能有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.