English 中文(简体)
计算机系统运行问题
原标题:iPhone File system operation questions

I want to download files from remote to temp folder

相距:

http://remoteserver.com/abc/def/file1.txt
http://remoteserver.com/abc/file2.png
http://remoteserver.com/abc/pla/mnb/file3.html

并且组合结构将:

tmpefolder/abc/def/file1.txt
tmpefolder/abc/file2.png
tmpefolder/abc/pla/mnb/file3.html

下载后,档案将像长期文件一样,并保持同样的双倍结构。

permanentfolder/abc/def/file1.txt
permanentfolder/abc/file2.png
permanentfolder/abc/pla/mnb/file3.html

最后,删除所有带有诱惑力的档案

因此,我的问题是:

  1. 从服务器下载多份文件的最佳方式是什么? (在显示ASIHTTPRequest时,用其他方式向我显示是 的)

  2. 创建整个文件夹结构的方便途径? 我是否必须把双管齐下的道路分为“/”并检查每一层次的道路,并创造道路?

  3. 如何将整个轮椅复制到永久翻版? 是否有可能用像文件十上的复印件这样的一项行动来做到这一点?

  4. 此外,与取消在第十号特别调查中的行动一样,将带一枪的弹片带走?

Thank you!

问题回答

1/ You d better use AFNetwork. <代码>ASIHTTPRequest正在生长,不再维持。 AFNetwork 更为现代化,并像房主所说的那样,与区块(“mmm,区块”)合作。 这里有许多例子,只是搜索。

具体来说,AFNetwork 请允许我表示,你可以按照你的意愿,同时下载35份档案,同时最多下载4份,并在一切照样的时候向你们报告。

2, 3, 4/ Take a look at the reference for NSFileManager. All you need is there.

create .zip of all your file use following code to download .zip form server. this will create your folder in NSTemporaryDirectory.

 NSString *filePath = [NSString stringWithFormat:@"%@/FILENAME.zip",NSTemporaryDirectory()];
 [[NSFileManager defaultManager] createFileAtPath:filePath contents:[NSData dataWithContentsOfURL:[NSURL URLWithString:[obj valueForKey:@"zip_path"]]] attributes:nil];

下载文件目录。

[[NSFileManager defaultManager] moveItemAtPath:filePath toPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] error:nil];

之后的法典删除了档案,以减速。

[[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签