NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console2.log"];
freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
'通过此代码,我可以在应用程序路径(应用程序支持 -
)中的日志文件中获取日志iPhone模拟器 - > ...),但我希望日志文件中的日志存在于资源文件夹中。我该怎么做?'
答案 0 :(得分:1)
如果你引用了应用程序自己的资源文件夹,那么这是不可能的,因为这是写保护的。您可以在模拟器上调整权限,但是当您在设备上进行测试时,它将失败。