读取文件

    NSBundle *mainBundle=[NSBundle mainBundle];
    
    NSString * txtPath=[mainBundle pathForResource:@"badytype_index" ofType:@"txt"];
    NSString *result=[[NSString alloc] initWithContentsOfFile:txtPath encoding:NSUTF8StringEncoding error:nil];
原文地址:https://www.cnblogs.com/skyblue/p/2872785.html