我在离子项目中遇到实施Avivais Phonegap-Plugin-parse的问题。以下是我遵循的步骤。
问题
我总是得到Reference Error: parsePlugin not defined
。
遵循的步骤
一个。在Ionic项目目录中运行此命令。
cordova plugin add https://github.com/benjie/phonegap-parse-plugin
湾添加android平台。 ionic platform add android
℃。在www/js/app.js
中添加此代码。
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
try{
parsePlugin.initialize('XXX', 'YYY', function() {
alert('success');
}, function(e) {
alert('error');
});
}catch(err){
alert('Parse Error '+err.message); //this gets executed all time
}
});
})
注意
一个。该插件已安装并显示在plugins/org.apache.cordova.core.parseplugin
湾platforms/android/res/xml/config.xml
有
<feature name="ParsePlugin">
<param name="android-package" value="org.apache.cordova.core.ParsePlugin" />
</feature>
℃。 index.html
有<script src="cordova.js"></script>
d。 AndroidManifest.xml
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.ionicframework.ecopulse420832" />
</intent-filter>
</receiver>
任何人都可以告诉我在这里添加或检查的是什么?