我收到此错误“由于未捕获的异常终止应用AmazonServiceException
,原因:'(null)'”请求从S3获取对象时,这是我的代码:< / p>
AmazonS3Client *s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID
withSecretKey:SECRET_KEY];
S3TransferManager *tm = [S3TransferManager new];
tm.s3 = s3;
S3GetObjectRequest *getObjectRequest = [[S3GetObjectRequest alloc] initWithKey:@"1234/history.json" withBucket:S3TRANSFERMANAGER_BUCKET];
[s3 getObject:getObjectRequest];
S3GetObjectResponse *getObjectResponse = [s3 getObject:getObjectRequest];
NSData *data = getObjectResponse.body;
NSError *error = nil;
NSArray *jsonArrayNewObject = [NSJSONSerialization JSONObjectWithData:json options:kNilOptions error:&error];
NSArray *jsonArrayHistoryObject = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSMutableArray *historyList = [jsonArrayHistoryObject mutableCopy];
[historyList addObjectsFromArray:jsonArrayNewObject];
NSDictionary *dictionary = [[NSDictionary alloc] init];
dictionary = [historyList mutableCopy];
NSData *jsonData = [NSJSONSerialization
dataWithJSONObject:dictionary
options:NSJSONWritingPrettyPrinted
error:&error];
[self upload:jsonData];
答案 0 :(得分:1)
我将看一下AWS iOS SDK的iOS示例应用程序部分:https://github.com/awslabs/aws-sdk-ios-samples
它包含S3文件传输(上传和下载)示例