最终使用PFFile(解析本地数据存储)保存在PFObject上吗? [英] Save eventually on PFObject with PFFile (Parse Local Datastore)?

查看:126
本文介绍了最终使用PFFile(解析本地数据存储)保存在PFObject上吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试保存具有PFFile作为属性的PFObject.我正在为iOS使用新的 Local Datastore ,所以我想使用saveEventually()方法保存此PFObject.

I am trying to save a PFObject that has a PFFile as an attribute. I am using the new Local Datastore for iOS, so I would like to save this PFObject with the saveEventually() method.

我遇到的问题是saveEventually()方法似乎不喜欢保存PFFiles.我尝试在没有附加任何PFFile的情况下saveEventually()我的对象,并且工作正常.重新连接我的PFFile后,Xcode抛出了几个断点通知(错误?),但没有终止该应用程序,而且看起来一切正常,但是对Parse Data Browser的检查确认保存确实完成了不经过.

在使用本地数据存储"功能之前,我不认为可以进行此保存-它会引发"Unable to saveEventually a PFObject with a relation to a new, unsaved PFFile."错误. iOS本地数据存储区文档中指出: >

The problem I am encountering is that the saveEventually() method doesn't seem to like saving the PFFiles. I tried to saveEventually() my object without any PFFile attached, and that worked fine. As soon as my PFFile was reattached, Xcode threw a couple of breakpoint notices (errors?) but did not terminate the app, and it appears as though all went well - however a check on the Parse Data Browser confirms that the save did not go through.

Prior to the Local Datastore feature I don't believe this save would have been possible - it would have thrown the "Unable to saveEventually a PFObject with a relation to a new, unsaved PFFile." error. It seems as though the Local Datastore feature has fixed this, as it states in the iOS Local Datastore docs:

固定PFObject的过程是递归的,就像保存一样,因此任何对象 您固定的对象所指向的对象也将被固定. 固定对象后,每次通过抓取或更新对象 保存新数据,本地数据存储区中的副本将被更新 自动地.您完全不必担心."

"Pinning a PFObject is recursive, just like saving, so any objects that are pointed to by the one you are pinning will also be pinned. When an object is pinned, every time you update it by fetching or saving new data, the copy in the local datastore will be updated automatically. You don't need to worry about it at all."

我已将SDK更新到最新版本(v1.6.2).有任何想法吗?

I have updated the SDK to the latest version (v1.6.2). Any ideas?

推荐答案

PFFile仍然不支持saveEventually

PFFiles still don't support saveEventually see here

该页面的最新更新时间:2015年1月23日

That page was last updated : 2015-01-23

您可以pinInBackgroundWithBlock,如果成功,则将PFFile保存到应用程序捆绑包中的临时文件夹中,并在必要时将其删除或取消固定

You could pinInBackgroundWithBlock and if successful save the PFFile to a temporary folder in you app bundle and delete it when necessary or unpinned

这篇关于最终使用PFFile(解析本地数据存储)保存在PFObject上吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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