-1

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.

Peter
  • 1,053
  • 13
  • 29

1 Answers1

0

There might be some default file size limit set on Parse Server (you can set your own of course).

Parse.com docs state:

Parse Files are limited to 10 MB each and the limit cannot be increased. There is no limit on how many Parse Files your app can create.

David Riha
  • 1,368
  • 14
  • 29
  • 'PFFile' no longer has a limit. But all the files in 'splitArray' are under 10mb anyway – Peter Apr 18 '16 at 18:59