2

我有一个使用 Parse API + 服务器的应用程序。我最近将它迁移到 AWS 服务器和 MongoDB。迁移后,我看到 PFFile 无法保存到超过 800 KB 的服务器上。我基本上是使用图像选择器从用户那里获取图像,然后以下列方式保存它。

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *pickedImage = [info objectForKey:UIImagePickerControllerOriginalImage];    


    [self dismissViewControllerAnimated:YES completion:^{

        NSError *fileError;
        NSData *imageData = UIImageJPEGRepresentation(_selectedImage, .9);
        PFFile *imageFile = [PFFile fileWithName:@"pimg.jpg" data:imageData contentType:@"image/jpeg" error:&fileError];
        if(fileError) {
            [Utilities popUpMessage:@"file error"];
        }

        [imageFile saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {

            if(!error) {
                //SUCCESS

            } else {
                NSLog(@"Error: %@",error.debugDescription);
                //FAILURE
            }

        }];

    }];
}

以下是我得到的错误描述 -

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.}

感谢任何帮助。

4

0 回答 0