我正在尝试在此处搜索名为 1 到 6 的 plist,并且我编写了此代码,并且它使应用程序比原始时间多消耗 3 秒来加载 ....代码是
for (int i=1;i<6;i++) {
NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
NSArray *dirContents = [[NSFileManager defaultManager] directoryContentsAtPath:bundleRoot];
for (NSString *tString in dirContents) {
if ([tString hasPrefix:[NSString stringWithFormat:@"%d",i]] && [tString hasSuffix:@".plist"]) {
NSLog(@"file found");
NSString *plist = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%d",i] ofType:@"plist"];
mute = [NSMutableArray arrayWithContentsOfFile:plist];
[mute addObjectsFromArray:contentArray];
contentArray = mute;
}
else {
NSLog(@"not found");
}
}
}
有人可以用解决方案打我还是在这里定义问题所在