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)
ロードされないのはなぜですか? 問題はどこにありますか?
ありがとう
シャニ