NSString * hisPath = [[NSPathEx DocPath] stringByAppendingFormat:@"/Log.txt"];
NSString* strHistory = [NSString stringWithContentsOfFile:hisPath encoding:NSUTF8StringEncoding error:nil];
if (strHistory != nil)
{
NSString* newStr = [strHistory stringByAppendingString:strLog];
[newStr writeToFile:hisPath atomically:YES encoding:NSUTF8StringEncoding error:nil];
}
else
{
[strLog writeToFile:hisPath atomically:YES encoding:NSUTF8StringEncoding error:nil];
}
在iphone指定目录写文件log
最新推荐文章于 2021-06-23 15:17:32 发布