sha*_*oga 5 nsbundle localizable.strings ios
我试图获得一个字符串文件表,用于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;
}
Run Code Online (Sandbox Code Playgroud)
虽然它在模拟器上运行良好,但当我尝试在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)
Run Code Online (Sandbox Code Playgroud)
为什么不加载,问题出在哪里?
谢谢
沙尼
| 归档时间: |
|
| 查看次数: |
10502 次 |
| 最近记录: |