繁体   English   中英

AFAmazonS3Manager错误

[英]AFAmazonS3Manager Error

我正在尝试在我的应用程序中使用AFAmazonS3Manager 我正在尝试将照片上传到亚马逊,但我不断收到此错误:

Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x1740e3f00 {NSUnderlyingError=0x170247dd0 "The requested URL was not found on this server.", NSErrorFailingURLStringKey=file:///var/mobile/Containers/Data/Application/myInfo, NSErrorFailingURLKey=file:///var/mobile/Containers/Data/Application/myInfo, NSLocalizedDescription=The requested URL was not found on this server.

我的代码很简单:

    AFAmazonS3Manager * s3Manager = [[AFAmazonS3Manager alloc]initWithAccessKeyID:amazonAccessKey secret:amazonSecret];
s3Manager.requestSerializer.region = AFAmazonS3USStandardRegion;
s3Manager.requestSerializer.bucket = amazonBucket;

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:photoName];
[UIImagePNGRepresentation(photo) writeToFile:filePath atomically:YES];

[s3Manager postObjectWithFile:filePath destinationPath:@"" parameters:nil progress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {

    int percent = roundf((float)totalBytesWritten / (float)totalBytesExpectedToWrite * 100);
    NSLog(@"Percent Complete: %d%%",percent);

我已经遇到了这个问题几天了。 我是使用AWS的新手,所以不知道我在做什么错。

根据错误消息,可能是您传递的请求网址无效,或者您提供的路径中不存在该图像。请检查您使用的url路径,如果该图像确实存在或存在通过复制粘贴到浏览器中的网址有效。 这是一个可能也对您有帮助的链接: http : //www.splinter.com.au/2014/10/15/upload-to-s3-from-ios/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM