我刚刚开始将 Parse.com 用于 Android 应用程序的后端。虽然这似乎微不足道,但我正在努力度过难关。我按照基础步骤测试是否发送了数据。但我无法得到它。我在模拟器上的应用程序运行成功。在日志级别,我看到一条日志消息错误:身份验证错误:无法响应任何这些挑战:{}
如果有人能指导我完成这个场景,我将不胜感激。我还复制了代码片段。
ParseApplication.java
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, MY_APPLICATION_ID, MY_CLIENT_KEY");
/*// Add your initialization code here
Parse.initialize(this, YOUR_APPLICATION_ID, YOUR_CLIENT_KEY);*/
}
ParseStarterProjectActivity.java
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
ParseAnalytics.trackAppOpened(getIntent());
}
AndriodManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.parse.starter" android:versionCode="1" android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name="ParseApplication"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".ParseStarterProjectActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>