【发布时间】:2017-12-27 12:13:46
【问题描述】:
我正在我的应用上使用 FCM 开发推送通知功能,适用于 Android 和 iOS。
After I successuflly managed the push notifications on Android devices,我试图在 iOS 上做同样的事情。
所以,我开始创建模板,就像我为 Android 制作的一样。
但是,创建模板时出现错误:
开始为 ios 构建
正在上传 iOS 密钥...
完成
正在上传应用模板...
完成
构建状态:待定(13 次尝试)
构建状态:错误(“plugman install --platform ios --project /tmp/gimlet/2719563/project --plugin phonegap-plugin-push@1.9.0”:获取插件“phonegap-plugin-通过 npm 推送@1.9.0"
在“1.9.0”为 ios 安装“phonegap-plugin-push”
无法安装“phonegap-plugin-push”:未定义 不明确的 )
正在删除 iOS 密钥...
完成
正在删除应用程序模板...
完成
错误:构建状态:错误(“plugman install --platform ios --project /tmp/gimlet/2719563/project --plugin phonegap-plugin-push@1.9.0”:获取插件“phonegap- plugin-push@1.9.0" 通过 npm
在“1.9.0”为 ios 安装“phonegap-plugin-push”
无法安装“phonegap-plugin-push”:未定义 不明确的 )
这是我的 config.xml 文件:
<widget id="com.devexpress.apptemplate" version="1.0" versionCode="1">
<name>ApplicationTemplate</name>
<description>Template</description>
<preference name="phonegap-version" value="cli-6.4.0" />
<preference name="permissions" value="none" />
<preference name="prerendered-icon" value="true" />
<preference name="android-windowSoftInputMode" value="adjustPan" />
<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="60000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000000" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-targetSdkVersion" value="22" />
<plugin name="cordova-plugin-geolocation" />
<plugin name="cordova-plugin-splashscreen" onload="true" />
<plugin name="cordova-plugin-whitelist" />
<plugin name="cordova-plugin-ios-longpress-fix" />
<plugin name="cordova-plugin-statusbar" onload="true" />
<plugin name="phonegap-plugin-push" spec="1.9.0"/>
<access origin="*" />
</widget>
config.xml 文件在项目 APP.mobile 中(不在 APP.shared 中)。我不明白为什么我可以为 Android 构建原生模板(而且它的工作原理很吸引人)而在 iOS 中却不行。
更新:这里总结了所有步骤:https://programmingistheway.wordpress.com/2017/07/19/devextremephonegap-how-to-manage-push-notifications-with-fcm/
【问题讨论】:
-
请使用cordova平台检查您的ios版本。可能是你的ios版本不支持插件需要ios版本。
-
解决了在 config.xml 中添加“senderID”参数的问题。我注意到它在这里对 Android 没用,但对 iOS 来说是强制性的。
-
是的,你也必须在 ios build 中写入 senderId。否则会产生错误。
标签: ios cordova templates push-notification phonegap-plugins