Reputation: 79
Image is not uploading in a amazon s3 . I was using the old library all the upload was working fine but for ios 8 i use new sdk and create new conginito id now i am facing errors. any help will be appreciated My code is
AWSS3TransferManagerUploadRequest *request = [[AWSS3TransferManagerUploadRequest alloc] init];
request.bucket = @"my bucket name";
request.key = @"my cognitio id";
request.body =[NSURL fileURLWithPath:path];
request.contentType = @"image/png";
[[transferManager upload:request] continueWithExecutor:[BFExecutor mainThreadExecutor]
withBlock:^id(BFTask *task) {
NSLog(@"ckmdkcd dvdsv");
if (task.error) {
if ([task.error.domain isEqualToString:AWSS3TransferManagerErrorDomain]) {
switch (task.error.code) {
case AWSS3TransferManagerErrorCancelled:
case AWSS3TransferManagerErrorPaused:
break;
default:
NSLog(@"Error: %@", task.error);
break;
}
} else {
// Unknown error.
NSLog(@"Error: %@", task.error);
}
}
if (task.result) {
AWSS3TransferManagerUploadOutput *uploadOutput = task.result;
// The file uploaded successfully.
NSLog(@"result = %@",task.result);
}
return nil;
}];
I got the following response
AWSiOSSDKv2 [Error] AWSIdentityProvider.m line:185 | __51-[AWSAbstractCognitoIdentityProvider getIdentityId]_block_invoke169 | GetId failed. Error is [Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}]
2015-04-14 08:13:16.326 newtest[6611:172200] AWSiOSSDKv2 [Error] AWSCredentialsProvider.m line:534 | __40-[AWSCognitoCredentialsProvider refresh]_block_invoke350 | Unable to refresh. Error is [Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}]
2015-04-14 08:13:16.328 newtest[6611:172071] ckmdkcd dvdsv
2015-04-14 08:13:16.328 newtest[6611:172071] Error: Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}
I am also setting cognitio id in app delegate.
Upvotes: 1
Views: 1522
Reputation: 9040
Based on the fact that you seeing https://cognito-identity.(null).amazonaws.com/
in the error, it would lead me to believe you are not correctly setting the region when creating the AWSCognitoCredentialsProvider
. Please double check that you are not setting this to AWSRegionUnknown
.
Update 2015-04-17: Here is the list of Region constants. You should set this to the region where your identity pool exists. Currently Amazon Cognito is only available in AWSRegionUSEast1
or AWSRegionEUWest1
.
Note, the region of your identity pool has nothing to do the region of other AWS services you may use in your application. You can use an identity pool in AWSRegionUSEast1
to access resources in AWSRegionSAEast1
, for instance.
Upvotes: 2