我有一个日志功能,在这里我有日志文件.现在,每次运行程序时,我都希望以前写入的文件不会被删除,并且应该附加当前数据(日志文件中有什么)
只是为了说清楚例如:我有一个日志文件logging_20120409.log,它每天保存时间戳.假设我运行我的项目,它会将当前时间戳写入其中.现在,如果我重新运行它,之前的时间戳将被替换.我不想要这个功能.我想要上一个时间戳和当前时间戳.
请帮忙
我有疑问:我想避免[UIImage imageNamed:].所以我做了:
UIImage *prodImg = [[UIImage alloc] initWithContentsOfFile:@"myimage.png"];
controller.productImg.image = prodImg;
[prodImg release];
Run Code Online (Sandbox Code Playgroud)
但现在图像不再显示了.
有谁知道如何让它工作?
我试图找出如何在应用程序内本地访问json文件.目前我一直在从这样的服务器远程使用json文件:
jsonStringCategory = @"http://****categories?country=us";
}
// Download the JSON file
NSString *jsonString = [NSString
stringWithContentsOfURL:[NSURL URLWithString:jsonStringCategory]
encoding:NSStringEncodingConversionAllowLossy|NSUTF8StringEncoding
error:nil];
NSLog(@"jsonStringCategory is %@", jsonStringCategory);
NSMutableArray *itemsTMP = [[NSMutableArray alloc] init];
// Create parser
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *results = [parser objectWithString:jsonString error:nil];
itemsTMP = [results objectForKey:@"results"];
self.arForTable = [itemsTMP copy];
[self.tableView reloadData];
Run Code Online (Sandbox Code Playgroud)
我试过这个:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"categoriesus" ofType:@"json"];
jsonStringCategory = [[NSString alloc] initWithContentsOfFile:filePath];
Run Code Online (Sandbox Code Playgroud)
谢谢
objective-c ×2
append ×1
c++ ×1
file ×1
imagenamed ×1
ios ×1
iphone ×1
json ×1
uiimage ×1
xcode ×1