Loading resource file from main bundle

This workaround the issue where file are not file, because their are in a different bundle when using frameworks.
This commit is contained in:
Zhigang Fang
2016-09-04 15:39:05 +08:00
parent 8844abfb75
commit 3d9aceafbb

View File

@@ -36,7 +36,7 @@
for (id l in langs) {
if ([l isKindOfClass:[NSString class]]) {
NSString* lang = l;
NSString* path = [[NSBundle bundleForClass:[self class]] pathForResource:lang ofType:@"lproj"];
NSString* path = [[NSBundle mainBundle] pathForResource:lang ofType:@"lproj"];
NSString* langFile = [path stringByAppendingPathComponent:filename];
if (langFile) {
[langsToRead addObject:lang];