我使用以下代码将图像上传到 AWS S3:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:pathComp];
[UIImageJPEGRepresentation(myImage,0.9) writeToFile:filePath atomically:NO];
filePath = [NSString stringWithFormat:@"file:///private%@", filePath];
NSURL* fileUrl = [NSURL URLWithString:filePath];
AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
uploadRequest.key = key;
uploadRequest.body = fileUrl;
uploadRequest.contentType = @"image/jpeg";
它上传正常,但在机械土耳其人我无法打开预览
This page contains the following errors:
error on line 1 at column 1: Document is empty
error on line 1 at column 1: Encoding error
Below is a rendering of the page up to the first error.