使用saveEventually()代替parseUser或ParseObject的save()或saveInBackground() [英] Using saveEventually() instead of save() or saveInBackground() for ParseUser or ParseObject

查看:81
本文介绍了使用saveEventually()代替parseUser或ParseObject的save()或saveInBackground()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看Parse文档,有一个saveEventually()方法可以代替save()和saveInBackground()使用.

Looking at Parse documentation, there is a saveEventually() method that can be used in place of save() and saveInBackground().

我可以在代码中的任何地方使用此功能来代替save和saveInBackground吗,这样我就不必担心用户在脱机和联机之间切换,并且在没有任何情况的情况下也不必处理保存连接性?使用这种方法是否有任何弊端?

Can I use this function everywhere in my code in place of save and saveInBackground so I don't have to worry about the user switching between being offline and online and I won't have to handle saving in situations where there is no connectivity? Are there any drawbacks to using this approach?

推荐答案

根据Parse的 iOS指南:

大多数保存功能会立即执行,并在保存完成时通知您的应用.如果您不需要知道保存完成的时间,则可以使用saveEventually.好处是,如果用户当前没有网络连接,则saveEventually会将更新存储在设备上,直到重新建立网络连接为止.如果您的应用在连接恢复之前已关闭,则Parse将在下次打开该应用时重试.

Most save functions execute immediately, and inform your app when the save is complete. If you don't need to know when the save has finished, you can use saveEventually instead. The advantage is that if the user currently doesn't have a network connection, saveEventually will store the update on the device until a network connection is re-established. If your app is closed before the connection is back, Parse will try again the next time the app is opened.

因此,保存完成后,如果需要回调,将使用save.我认为您可以根据所处的情况同时使用两者.

So you will use save if you need the callback when the save has finished. I think you can use both depending on the situation you are handling.

这篇关于使用saveEventually()代替parseUser或ParseObject的save()或saveInBackground()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆