Closed xifengzhu closed 8 years ago
我看到这个插件在cordova-plugin-xgpush 里面有声明依赖,而且我装好cordova-plugin-xgpush这个之后发现https://github.com/vstirbu/PromisesPlugin 这个也被安装好了。
是需要有个安装先后顺序的问题么?
确实是顺序的问题
我测了一下,依赖的插件加载的 js 的比原有插件的 js 要晚,所以 Promise Polyfill 没执行,导致在比较老的手机上用不了 Promise
暂时的解决方法是在项目里的 config.xml 里,按照如下顺序放置插件:
<plugin name="es6-promise-plugin" spec="~3.0.2" />
<plugin name="cordova-plugin-xgpush" spec="https://github.com/gengen1988/xgpush-cordova.git">
<variable name="ACCESS_ID" value="你的 ACCESS ID" />
<variable name="ACCESS_KEY" value="你的 ACCESS KEY" />
</plugin>
这个方法在 coolpad 8705 (原生不支持 Promise)上测试可行
谢谢,我去试试。
已经内置了 Promise polyfill,不会有这样的问题了
Uncaught ReferenceError: Promise is not defined, error: plugins/cordova-plugin-xgpush/www/xgpush.js, Line: 1 Android