0

I've seen some rumors/opinions on this, but does anyone know definitively if a PFFile can be stored/fetched to the datastore if it is a property of a PFObject?

For example, I have a class which is a subclassed PFObject. Within the class, is a PFFile property:

@interface Stats : PFObject <PFSubclassing, NSCoding>
...
@property  PFFile *historyFile;

When I fetch the Stats object from the local data store, everything is retrieved, but this call:

NSData *data = [self.historyFile getData];

causes a crash:

NSInvalidArgumentException', reason: '*** -[_NSPlaceholderData initWithContentsOfFile:options:error:]: nil file argument

Any thoughts?

rswayz
  • 1,122
  • 2
  • 10
  • 21

1 Answers1

1

No, you can't store the file itself with pinning because PFFile does not have a pin() method.

You need to test for a successful save on the object and then store the file manually in your app if the object was successfully saved.

More info: https://stackoverflow.com/a/28136535/1485715

Community
  • 1
  • 1
Marius Waldal
  • 9,537
  • 4
  • 30
  • 44
  • Thanks! Seen any best practices for dealing with no-internet situations and storing data locally that should get saved to PFFile eventually? – rswayz Nov 20 '15 at 21:13