gpt4 book ai didi

java - 无法删除 ParseObject

转载 作者:行者123 更新时间:2023-11-29 20:08:58 26 4
gpt4 key购买 nike

我遇到了一个奇怪的错误。我无法删除我的 Favourite扩展 ParseObject 的对象.

当我尝试执行这段代码时发生错误:

ParseQuery<Favourite> query = getCurrentUserFavouriteTracks(user, track);
query.findInBackground(new FindCallback<Favourite>() {
@Override
public void done(List<Favourite> objects, ParseException e) {
if (e == null) {
for (Favourite favourite : objects)
favourite.deleteInBackground(new DeleteCallback() {
@Override
public void done(ParseException e) {
if (e != null)
Log.e("DEBUG_TAG", "Error", e);
}
});
}
}
});

List<Favourite> objects非空且不为空。执行上面的代码后,我在这一行收到当前错误 Log.e("DEBUG_TAG", "Error", e); :

com.parse.ParseException: java.lang.ClassCastException: com.squareup.okhttp.RequestBody$2 cannot be cast to com.parse.ParseOkHttpClient$ParseOkHttpRequestBody

我发现一些信息表明该错误可能与 Stetho 有关。 Link

这是我的 build.gradle并扩展 Application.class

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
// Optional -- Hamcrest library
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
// Optional -- UI testing with Espresso
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.parse:parse-android:1.11.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.facebook.stetho:stetho:1.3.0'
compile 'com.parse:parseinterceptors:0.0.1'
}

.

ParseObject.registerSubclass(Track.class);
ParseObject.registerSubclass(ParseWaypoint.class);
ParseObject.registerSubclass(UserType.class);
ParseObject.registerSubclass(City.class);
ParseObject.registerSubclass(ReachedWaypoint.class);
ParseObject.registerSubclass(TrackWaypoint.class);
ParseObject.registerSubclass(Favourite.class);

ParseUser.registerSubclass(MyParseUser.class);

Parse.enableLocalDatastore(this);

if (BuildConfig.DEBUG) {
Stetho.initializeWithDefaults(this);

Parse.addParseNetworkInterceptor(new ParseStethoInterceptor());
}

Parse.initialize(this, "****", "****");
ParseInstallation.getCurrentInstallation().saveInBackground();

我希望你能帮助我。如果您有任何问题,请发表评论。

最佳答案

将 Parse Android SDK 升级到 1.13.0,应该可以修复它。 (注:1.13.1存在该问题)。

关于java - 无法删除 ParseObject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35296416/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com