从iPhone模拟器中的硬盘读取文件 [英] Reading a file from a hard drive in iPhone simulator
问题描述
是否可以从我的普通文件系统中读取文件到运行在iPhone模拟器上的iPhone应用程序中?
Is it possible to read a file (from my normal file system) into a iPhone App running on the iPhone Simulator?
我了解到iPhone本身还没有(用户可访问的)文件系统,但这只是出于测试目的,只能在模拟器中运行.
I understand that the iPhone itself has not got a (user accessible) file system but this is simply for testing and will only ever be run in the simulator.
该文件将是一个文本文件,可以在应用程序运行时对其进行编辑,每次调用方法时都将读取该文件.
The file will be a text file that can be edited while the application is running, it will be read every-time a method is called.
推荐答案
是的,可以,无论在哪里都可以.只需在加载时为其提供绝对路径名即可(运行模拟器时Xcode无法识别其他工作目录).
Yes, you can, and it doesn't matter where it is. Just give it an absolute path name when you load it (Xcode won't recognize a different working directory when running the simulator).
这篇关于从iPhone模拟器中的硬盘读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!