2014-03-28 45 views
0

我得到這個錯誤「終止應用程序由於未捕獲的異常AmazonServiceException原因:‘(空)’」獲得請求時,請求從S3獲得對象的時候,這裏是我的代碼:錯誤AWS

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]; 

回答