Image within PFFile will be uploaded to parse instead of being saved into the local datastorage

后端 未结 1 533
南方客
南方客 2020-12-16 08:24

I am using swift with the Parse Framework (1.6.2). I am storing data into the local datastorage. The data consists of a few strings and an image. This image will be stored w

相关标签:
1条回答
  • 2020-12-16 08:56

    Okay, take a look here Save eventually on PFObject with PFFile (Parse Local Datastore)?. One this is for sure, if you call save on PFFile it will get save to online datastore. So you should use PFFile.save(). I think best option for you is to save the file in some folder. locally and save that path in PFObject. Parse documentation just say this

    "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."
    

    It recursively calls .pin() on the other objects in your main PFObject. But if you take a look at PFFile API doc it doest have a .pin() which means it doesn't support saving PFFile to local datastore. So I would say you should save them in some directory and save path in your PFObject.

    Update

    save:
    
    Saves the file synchronously and sets an error if it occurs.
    
    - (BOOL)save:(NSError **)error
    Parameters
    error
    Pointer to an NSError that will be set if necessary.
    
    Return Value
    Returns whether the save succeeded.
    
    0 讨论(0)
提交回复
热议问题