我使用以下代码获取s3-bucket中的项目列表:
ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:@"my-bucket"];
NSString *key = kS3SecretKey;
[request setSecretAccessKey:key];
key = kS3AccessKey;
[request setAccessKey:key];
[request setMaxResultCount:50]; // Max number of results we want
[request setDelegate:self];
[request setDidFailSelector:@selector(requestContentListFromBuckeFailed:)];
[request setDidFinishSelector:@selector(requestContentListFromBuckeSuccessfull:)];
[request startAsynchronous];
当我收到respose并记录它时。它采用xml
的形式-(void) requestContentListFromBuckeSuccessfull: (id) request
{
NSString *response = [[NSString alloc] initWithData:[request responseData] encoding:NSUTF8StringEncoding];
NSLog(@"response=%@",response);
}
我的问题是我可以设置接收JSON响应的请求吗?
答案 0 :(得分:1)
没有
你无法在json中获得s3响应。 Amazon S3不支持json响应。为此,您必须在目标C代码中使用xml解析器。