ios - firebase 通知 cordova ios 集成
<p><p>我正在尝试在 cordova app ios 上添加 firebase 通知,但我不能。
这是我已经完成的步骤:</p>
<p>1-创建了firebase项目<br/>
2-复制配置文件Googleservice-info.plist<br/>
3-安装cordova插件fcm<br/>
4-将此代码添加到文件 index.js<br/></p>
<pre><code>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);
</code></pre>
<p>5 安装 cocoapods
6-执行了这个命令:</p>
<pre><code>pod init
</code></pre>
<p>7-in 文件 PodFile 我已插入此代码:</p>
<pre><code>pod ’Firebase/Core’
pod 'Firebase/Messaging'
</code></pre>
<p>使用此命令安装 8 个 pod:</p>
<pre><code>pod install
</code></pre>
<p>10-用.xcworkspace文件打开项目
<br/>
现在 xcode 向我返回此错误:</p>
<pre><code>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.
</code></pre>
<p>怎么了?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>你需要安装这个:</p>
<pre><code>cordova plugin add cordova-plugin-cocoapod-support --save
</code></pre>
<p>这对我有用。</p></p>
<p style="font-size: 20px;">关于ios - firebase 通知 cordova ios 集成,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/42735694/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/42735694/
</a>
</p>
页:
[1]