我正在尝试获取与 NSLocalizedStringFromTableInBundle 一起使用的字符串文件表。
我正在使用这种方法:
+(NSBundle*)getBundleForLang:(NSString*)lang{
//get the path to the bundle
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"localizable" ofType:@"strings" inDirectory:nil forLocalization:lang];
NSLog(@"bundlePath = %@",bundlePath);
//load the bundle
NSBundle *langBundle = [[NSBundle alloc] initWithPath:[bundlePath stringByDeletingLastPathComponent]];
NSLog(@"langBundle = %@",langBundle);
return langBundle;
}
虽然它在模拟器上运行良好,但当我尝试在 iPhone 设备上使用它时,我得到了这个 NSLog:
2011-12-09 00:40:14.533 MyApp[12754:707] langBundle = NSBundle
</var/mobile/Applications/915E6BCB-EC44-4F1D-891B-EF68E2FA89C2/MyApp.app/he.lproj>
(not yet loaded)
为什么没有加载,问题出在哪里?
谢谢
沙尼