Search code examples
iosparse-platformpffilepfobject

PFObject won't save PFFile PArse


I can't seem to set a Pffile object as a value for a Pfobject key in Objective-C. I'm trying to save NSData from an AVAudioPlayer in a PFfile. If I do the folllowing:

NSData * audioData=[self.shoutInfoArray objectAtIndex:1];
PFFile * audiofile=[PFFile fileWithName:@"shoutData" data:audioData];
bool saved=[audiofile save]; //This bool is positive, so it does save!?
[shout fetchIfNeeded];
shout[@"audioData"]=audiofile; //BUGGY LINE

I get the following error:

Error: invalid type for key audioData, expected bytes, but got file (Code: 111, Version: 1.2.20)

Couldn't find why?


Solution

  • Clear your database. I mean drop column audioData. It seams something wrong with types.