【发布时间】:2014-06-10 07:17:21
【问题描述】:
我正在开发一个 IOS 应用程序,在该应用程序中我必须在 DropBox 上上传图像,但是当我在 iPhone 模拟器上一次上传图像时,只上传了 5-6 张图像,我遇到了连接超时(-1005 ),总是网络错误 ->
2014-06-10 11:42:53.283 PicBackMan_1[2602:60b] [WARNING] DropboxSDK: error making request to /1/metadata/dropbox/Photos - (404) Path '/Photos' not found
2014-06-10 11:42:53.285 PicBackMan_1[2602:60b] restClient:loadMetadataFailedWithError: The operation couldn’t be completed. (dropbox.com error 404.)
2014-06-10 11:42:55.167 PicBackMan_1[2602:60b] [WARNING] DropboxSDK: error making request to /1/files_put/dropbox/Super_12/PicBackMan-41.jpg - (-1005) Error Domain=NSURLErrorDomain Code=-1005 "The operation couldn’t be completed. (NSURLErrorDomain error -1005.)" UserInfo=0xa53b1d0 {destinationPath=/Super_12/PicBackMan-41.jpg, sourcePath=/Users/bettermac9/Library/Application Support/iPhone Simulator/7.1/Applications/F51F7F8F-91C5-4E67-90E6-4218941D3A67/Documents/image.jpg}
我收到这些类型的各种错误。iPhone 模拟器有什么问题吗。它在 iPhone 设备上是否正常工作? 请帮帮我。
我在 DropBox 上上传图片的代码
- (void)_startUpload:(UIImage *)image
{
UIBackgroundTaskIdentifier bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
NSLog(@"%@",(NSString*)countere);
}];
// while(countere != 0){
HUD=[[MBProgressHUD alloc]initWithView:self.view];
[self.view addSubview:HUD];
HUD.labelText=@"Please wait for Uploading";
HUD.dimBackground=YES;
[HUD show:YES];
//NSString *fileString=@"/%@",albumNAME;
// NSData * JPEGData = UIImageJPEGRepresentation(image, 1.0);
self.file = [NSString stringWithFormat:@"/%@",albumNAME];
NSLog(@"File Name ---> %@",self.file);
NSInteger randomNumber = arc4random() % 100;
NSString *filename = [NSString stringWithFormat:@"PicBackMan-%ld.jpg",(long)randomNumber];
NSArray *pathList = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES);
countere--;
NSString *localPath = [[pathList objectAtIndex:0] stringByAppendingPathComponent:@"image.jpg"];;
NSLog(@"local Path ----> %@",localPath);
NSString *destDir = self.file;
count4++;
// [presenter presentHud:@"Uploading"];
[[self restClient] uploadFile:filename toPath:destDir
withParentRev:nil fromPath:localPath];
if (count4%4==0) {
[NSThread sleepForTimeInterval:2];
NSLog(@"Background Thread Running");
}
//[NSThread sleepForTimeInterval:0.5];
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
// }
[self performSelectorOnMainThread:@selector(savingDone) withObject:nil waitUntilDone:YES];
}
【问题讨论】:
-
显示您正在使用的代码。不要尝试同时上传超过 4 个请求...
-
@wain:先生,这是我在 DropBox 上上传图片的代码->
-
请花时间格式化您的问题,以便阅读......
-
@wain 对不起,先生,如果您遇到问题,请帮帮我。我如何在用户的一次选择中上传超过 5 张图片。
标签: ios iphone dropbox dropbox-api