- (void)readLocalData {
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"txt"];
NSString *contents = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSArray *contentsArray = [contents componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
NSInteger idx;
for (idx = 0; idx < contentsArray.count; idx++) {
NSString* currentContent = [contentsArray objectAtIndex:idx];
NSLog(@"%@",currentContent);
}
}
iphone app中读取本地txt,csv文件
最新推荐文章于 2022-06-03 13:43:05 发布