2016-02-09 130 views
1

我遇到了一個奇怪的錯誤。我無法刪除我的Favourite對象,它擴展了ParseObject無法刪除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是非空的,而不是空:

的錯誤,當我試圖執行該代碼出現。 執行上面的代碼後,我recive此行Log.e("DEBUG_TAG", "Error", e);電流誤差:

com.parse.ParseException:java.lang.ClassCastException: 2 com.squareup.okhttp.RequestBody $不能轉換到 融爲一體。 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:[email protected]' 
    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(); 

我希望你能幫助我。如果您有問題,請發表評論。

回答

2

升級解析Android SDK到1.13.0,應該解決它。 (注意:該問題存在於1.13.1中)。