[英]AWS S3 SDKv2 and image upload ios on turk
我使用以下代碼將圖像上傳到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.
找到PaulTaykalo的適用於AWS開發工具包v2的解決方案
https://github.com/aws/aws-sdk-ios/issues/10
固定方法的鏈接http://pastie.org/9340740
還將這段代碼添加到混亂的方法中
[headers setValue:contentType forKey:@"Content-Type"];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.