简体   繁体   English

如何加载位于我的应用程序文件夹中的文件的内容?

[英]How do I load the contents of a file that resides in my app folder?

Using the loadFile selector and the loadedFile delegate selector, how do I read the contents of a file which is in my application's app folder on dropbox? 使用loadFile选择器和loadedFile委托选择器,如何读取loadedFile箱上应用程序的应用程序文件夹中文件的内容?

Are you supposed to loadFile: intoPath: and specify an absolute path on the disk (like a tmp folder?) from which you actually read the contents after the loadedFile delegate method is called? 您是否应该将loadFile: intoPath:并指定磁盘上的绝对路径(如tmp文件夹?),然后从该路径中实际读取内容,然后loadedFile委托方法?

Does the Dropbox IOS/OSX SDK automatically determine if the file is stored locally in the users' dropbox folder, and is at the current version, before fetching and downloading the file? 在提取和下载文件之前,Dropbox IOS / OSX SDK是否会自动确定文件是否存储在用户的dropbox文件夹中,并且是否为当前版本?

Am I missing something here? 我在这里想念什么吗? Or is this the intended implementation? 还是这是预期的实现?

Sorry for the newbish question, it just doesn't seem like there's a ton of concrete documentation on how to actually use this method. 对这个新问题很抱歉,似乎没有关于如何实际使用此方法的大量具体文档。

edit (for clarification) 编辑(澄清)

When I say I'd like to load the contents of the file, I want to dump the file contents into an NSString object. 当我说我想加载文件的内容时,我想将文件内容转储到NSString对象中。 Sorry if that wasn't clear. 很抱歉,如果不清楚。

 NSMutableArray *tempArray =[NSMutableArray arrayWithArray:[[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:Nil]];
 NSFileManager *fileManager =[NSFileManager defaultManager];
 NSString path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 path=[path stringByAppendingPathComponent:@"filename with extension"];

Now you can use path variable for loading file. 现在,您可以使用路径变量来加载文件。

Have a happy Coding.!! 祝您编码愉快!!

暂无
暂无

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

相关问题 如何删除mainBundle中.txt文件的内容 - How do I delete the contents of a .txt file in my mainBundle 如何使用iCloud同步我的sqlite数据库和驻留在应用程序库文件夹中的文件夹中的图像 - How to use iCloud for syncing my sqlite database and images that resides in the folder in the library folder of application 开发iPhone应用程序,如何从保存到我的应用程序文档文件夹的视频中获取视频“长度”? - Developing iPhone Application, How do i get video “length” from a video saved to my app docs folder? 如何在Facebook的iPhone应用程序中共享页面内容? - How can I share the contents of my page in iPhone app on facebook? 如何访问可可中的应用程序包内容文件夹? - How to access app package contents folder in cocoa? 如何在Mac App内容/ MacOS文件夹中添加我的自定义C ++可执行文件 - How to Add My Custom C++ Executable in Mac App Contents/MacOS Folder 如何在iOS 7 / Objective-C中以编程方式将UIPickerView捕捉到其所在的父视图的底部? - How do I programmatically snap a UIPickerView to the bottom of the parent view it resides in, in iOS 7/Objective-C? 如何加载正确的本地化文件? - How do I load the proper localized file? 我如何访问ipad上我的应用程序的持久性存储文件 - How do I gain access to the persistance store file of my app which is on my ipad 如何强制我的应用程序进入“ Applications /”文件夹? - How can I force my app into the Applications/ folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM