簡體   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