I am trying to save a new PFObject
and get the following error:
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
Supposedly this bug was fixed with the release of Parse-SDK-IOS-OSX 1.9.1. But I just recently updated to both the latest SDK and parse-server and continue to get the error.
I have three cases:
- saving a photo
- saving a small video < 10mb
- saving a large video > 10mb
The latter is the only cases that throws the error.
PFObject *new = [PFObject objectWithClassName:@"Moment"];
[new setObject:newUser forKey:@"user"];
[new setObject:[NSNumber numberWithBool:YES] forKey:@"profile"];
if ([dataObject sharedInstance].caption) [new setObject:[dataObject sharedInstance].caption forKey:@"caption"];
[new setObject:[dataObject sharedInstance].storyboard forKey:@"storyboard"];
if (largeVideo) {
NSLog(@"%@", [dataObject sharedInstance].splitArray);
for (int i = 0; i < [dataObject sharedInstance].splitArray.count; i++){
PFFile *file = [[dataObject sharedInstance].splitArray objectAtIndex:i];
if (i == 0) {
[new setObject:file forKey:@"video"];
}else{
[new setObject:file forKey:[NSString stringWithFormat:@"video%i", i]];
}
}
}else{
NSData *videoData = [[NSData alloc]initWithContentsOfURL:[dataObject sharedInstance].output];
PFFile *file = [PFFile fileWithData:videoData contentType:@"video/mp4"];
[new setObject:file forKey:@"video"];
}
[new setObject:fileF forKey:@"image"];
[new setObject:fileT forKey:@"thumbnail"];
[new saveInBackgroundWithBlock:^(BOOL succeded, NSError *error){
}];
Saving both a photo and a small video works fine.