parse.com提供了一种使用object.saveEventually();以离线模式保存对象的方法。
调用..它将对象存储在本地dataStore中,除非与服务器进行了同步。

问题是,我不能存储以下给定行的文件

ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 80, stream);
byte[] byteArray = stream.toByteArray();
file = new ParseFile("pic.png",byteArray);
object.put("file.png", file);
object.saveEventually();

它给出以下错误
java.lang.IllegalStateException: Unable to encode an unsaved ParseFile

根据解析文档保存文件file.saveInBackground应该被称为...
而且我认为saveInBackground仅在有互联网连接时才有效...

但是我要实现的是从本地dataStore获取数据(对象或文件),直到与服务器完成同步...

因此,如何以离线模式保存文件,这样我就可以从本地dataStore访问该文件,直到与服务器完成同步为止...

最佳答案

我也遇到了同样的问题,我这样做很符合我的要求。希望对您有所帮助。

How to pin a ParseObject with a ParseFile to the Parse Local Datastore in OFFLINE?

10-07 19:51
查看更多