xcode 下载FTP目录内容到ios
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10407238/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Download FTP directory contents to ios
提问by jwilk
I have a website, let's say it's "http://www.jwilkthings.com/stuff"
我有一个网站,假设它是“http://www.jwilkthings.com/stuff”
I have a bunch of .txt files stored on this website, i.e. "http://www.jwilkthings.com/stuff/text1.txt"
我在这个网站上存储了一堆 .txt 文件,即“http://www.jwilkthings.com/stuff/text1.txt”
What I'm wanting to do is find a way in iOS to download all of those text files without knowing what the document name is. I can already retrieve them manually as long as I have a file name, but I would rather just get all of them at once and put them in the documents directory if possible. I currently use FileZilla to upload all of the text files, so I can use FTP if needed.
我想要做的是在 iOS 中找到一种方法来下载所有这些文本文件,而无需知道文档名称是什么。只要我有文件名,我就可以手动检索它们,但我宁愿一次获取所有它们,并尽可能将它们放在文档目录中。我目前使用 FileZilla 上传所有文本文件,因此我可以在需要时使用 FTP。
回答by ckhan
The correct way to solve this problem is to not use FTP (riddled with performance and security issues), and to configure your web server to expose a table of contents directory listingthat your client can parse.
解决此问题的正确方法是不使用 FTP(充斥着性能和安全问题),并配置您的 Web 服务器以公开您的客户端可以解析的目录列表。
But that's not an answer to your question. If you really want your iOS app to speak FTP, take a look at the SimpleFTP sample project from Apple.
但这不是你问题的答案。如果您真的希望您的 iOS 应用程序支持 FTP,请查看Apple的SimpleFTP 示例项目。
It's old, but I just got it to build on iOS 5. The ListController.mfile has the code you're looking for.
它很旧,但我只是让它在 iOS 5 上构建。ListController.m文件包含您正在寻找的代码。