在object中,我似乎不能将Pffile对象设置为Pfobject键的值。我正在试图将NSData从AVAudioPlayer中保存到PFfile中。如果我这样做:
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我得到以下错误:
错误:键audioData的无效类型,预期字节,但已获得文件(代码: 111,版本: 1.2.20)
找不到原因?
发布于 2015-03-02 08:52:14
清除你的数据库。我是说drop列audioData。它缝上了一些类型的错误。
发布于 2014-08-07 16:50:34
要将PFFile对象保存为PFObject的一部分:还请检查文件大小不应大于10 be。
PFFile * audiofile=[PFFile fileWithName:@"shoutData.aif" data:audioData];
[imageFile saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
//Use async call.
// It is compulsory to save the PFFile object first and then used it with PFObject
if(succeeded)
{
PFObject *shout = [PFObject objectWithClassName:@"UserData"];
shout[@"audioData"] = audiofile;
[shout saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if(error)
{
NSLog(@"error %@",error.localizedDescription);
}
else
{
if(succeeded)
{
NSLog(@"object save on parse");
}
}
}];
}
}];https://stackoverflow.com/questions/25187747
复制相似问题