时间:2020-11-14 11:39:18 | 栏目:iOS代码 | 点击:次
废话不多说了,下面通过一段代码给大家介绍iOS 加载Bundle文件的方法,具体代码如下所示:
- (NSString *)loadJsFile:(NSString *)fileName Type:(NSString *)type{ NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:type]; NSString *string1 = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; NSString *string1 = [NSString stringWithContentsOfURL:[NSURL URLWithString:path] encoding:NSUTF8StringEncoding error:nil]; return jsScript; }