- (NSArray *)getTextLine:(NSString *)resource
{
NSString *fileName = [[resource componentsSeparatedByString:@"."] objectAtIndex:0];
NSString *extension =[resource pathExtension]; //获取结尾
NSString *filePath = [[NSBundle mainBundle]pathForResource:fileName ofType:extension ];
NSError *error = nil;
NSString *filePath_text = [[NSString alloc]initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error ];
NSLog(@"error : %@",error);
NSArray *file_lines = [NSArray array];
if (!error) {
file_lines = [filePath_text componentsSeparatedByString:@"\n"];
}
return file_lines;
}
原文链接:https://www.f2er.com/sqlite/201964.html