my app is creating a CSV file out of a db. I want to browse and open the file to test. How do I access the iphone simulator's storage ?
我的应用程序正在从数据库中创建一个CSV文件。我想浏览并打开文件进行测试。如何访问iphone模拟器的存储?
4 个解决方案
#1
5
All data of the Simulator is stored as local files on your Mac.
模拟器的所有数据都存储在Mac上的本地文件中。
The path for the user data of iOS apps in the Simulator is:
模拟器中iOS应用程序的用户数据路径为:
~/Library/Application Support/iPhone Simulator/[OS version]/Applications/[appGUID]/
〜/ Library / Application Support / iPhone Simulator / [OS version] / Applications / [appGUID] /
#2
1
You'll want to print out the location of where you store your file when you run the app in the simulator.
在模拟器中运行应用程序时,您需要打印出存储文件的位置。
You can use this code to get the location of the Library/Cache folder here:
您可以使用此代码获取Library / Cache文件夹的位置:
-(NSString *) mediaPathForFileName:(NSString *) fileName
{
NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDirectory = [directoryPaths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", cachesDirectory, fileName];
return filePath;
}
Pass in a random file name like "test.txt":
传入一个随机文件名,如“test.txt”:
// somewhere in your viewDidLoad method
[self mediaPathForFileName:@"test.txt"];
This will print out the path to your app Library/Cache folder.
这将打印出应用程序库/缓存文件夹的路径。
#3
0
you need get the path of that file by using NSLog
and then user Shift+Cmd+G
to go to that path.
您需要使用NSLog获取该文件的路径,然后使用Shift + Cmd + G转到该路径。
#4
0
pritn this path
pritn这条道路
NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSArray * directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);
#1
5
All data of the Simulator is stored as local files on your Mac.
模拟器的所有数据都存储在Mac上的本地文件中。
The path for the user data of iOS apps in the Simulator is:
模拟器中iOS应用程序的用户数据路径为:
~/Library/Application Support/iPhone Simulator/[OS version]/Applications/[appGUID]/
〜/ Library / Application Support / iPhone Simulator / [OS version] / Applications / [appGUID] /
#2
1
You'll want to print out the location of where you store your file when you run the app in the simulator.
在模拟器中运行应用程序时,您需要打印出存储文件的位置。
You can use this code to get the location of the Library/Cache folder here:
您可以使用此代码获取Library / Cache文件夹的位置:
-(NSString *) mediaPathForFileName:(NSString *) fileName
{
NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDirectory = [directoryPaths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", cachesDirectory, fileName];
return filePath;
}
Pass in a random file name like "test.txt":
传入一个随机文件名,如“test.txt”:
// somewhere in your viewDidLoad method
[self mediaPathForFileName:@"test.txt"];
This will print out the path to your app Library/Cache folder.
这将打印出应用程序库/缓存文件夹的路径。
#3
0
you need get the path of that file by using NSLog
and then user Shift+Cmd+G
to go to that path.
您需要使用NSLog获取该文件的路径,然后使用Shift + Cmd + G转到该路径。
#4
0
pritn this path
pritn这条道路
NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSArray * directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);