简体   繁体   English

Android上的Parse.com API PHP后端和本地存储

[英]Parse.com API PHP backend and local storage on Android

Since Parse.com was closing, i've recreated parse API endpoints, copied the SDKs on my own repository and changed SDKs base url to point to my server / PHP API. 自从Parse.com关闭以来,我已经重新创建了解析API端点,在自己的存储库中复制了SDK,并更改了SDK基本URL使其指向我的服务器/ PHP API。

My API reflects the Parse REST return formats for objects, Users, login, Installation and so on... (expect the Android SDKs actually don't respect whats said in parse API REST endpoints docs - it ALWAYS makes POST requests using a body parameter: {_method: GET|POST|PUT... how surprising and how NOT RESTfull !). 我的API反映了对象,用户,登录名,安装等对象的Parse REST返回格式...(期望Android SDK实际上不尊重parse API REST端点文档中所说的内容-它总是使用body参数发出POST请求:{_method:GET | POST | PUT ...多么令人惊讶,如何还没有RESTfull!)。

Anyway i've adapted my backend to that flaw and everything works... EXCEPT... 无论如何,我已经使后端适应了该缺陷,并且一切正常...除了...

That on the Android SDK (IOS not tested), everything crashed when objects are stored (or retrieved) in the local data storage. 在Android SDK(未经测试的IOS)上,当将对象存储(或检索)到本地数据存储中时,所有崩溃。

I'm looking for insights on where the problem might come from. 我正在寻找有关问题可能出处的见解。

Specs: 眼镜:

  • Backend: PHP REST API returning what the PARSE SDK wants; 后端:PHP REST API返回PARSE SDK的需求;

  • ObjectId(s) have been made persistent in my backend (i suspected this might come from this); ObjectId已在我的后端中保持不变(我怀疑这可能来自此);

  • Authorization is achieved via header X-Parse-Application-Id and X-Parse-Client-Key 通过标头X-Parse-Application-Id和X-Parse-Client-Key获得授权

Does anyone have any insights on how Parse works with object, syncronisation and local storage ? 是否有人对Parse如何与对象,同步和本地存储一起工作有任何见解? Might the problem be related to updatedAt / createdAt dates ? 问题可能与updateAt / createdAt日期有关吗?

Again, everything works fine when local storate is not involved. 同样,当不涉及本地存储时,一切正常。 I'm strongly suspecting the _Installation class to be the falt, but i have no way of debugging this due to my lack of knowledge on Android. 我强烈怀疑_Installation类是falt,但是由于我对Android缺乏了解,因此无法调试它。

PS: i'm willing to post the API code (developed under Symfony2) on github for everyone if i can fix this issue. PS:如果我可以解决此问题,我愿意将API代码(由Symfony2开发)发布在github上。

Hurray ! 万岁! This was not a backend issue but related to this change in the Android SDK: 这不是后端问题,但与Android SDK中的更改有关:

https://github.com/ParsePlatform/Parse-SDK-Android/issues/398 https://github.com/ParsePlatform/Parse-SDK-Android/issues/398

In short, when you use your own Parse server as described in the parse migration guide , you also need to update your SDK(s)... but... but... 简而言之,当您按照解析迁移指南中所述使用自己的解析服务器时,还需要更新SDK ...但是...但是...

... if you're using local storage on Android your have to use enableLocalDataStore() while "building" the configuration. ...如果您在Android上使用本地存储,则在“构建”配置时必须使用enableLocalDataStore()

I have no idea of how that plays with the IOS SDK but i suspect it would be the same. 我不知道如何与IOS SDK一起玩,但我怀疑它会是一样的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM