Reputation: 616
I'm using an NSBundle
to load localization files into my iOS app.
Since I'm building with Xcode 11 everything is still working as expected, but I get a warning each time I read localizations from that bundle:
Cannot find executable for CFBundle [...] (not loaded)
The thing is there is no executable in the bundle. It contains nothing but the localization files and an Info.plist
which looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
The bundle is loaded with
NSBundle *bundle = [NSBundle bundleWithPath:path];
if (![bundle isLoaded]) {
[bundle load];
}
and the localization read with
NSString *string = [bundle localizedStringForKey:key value:defaultValue table:nil];
Upvotes: 2
Views: 2205
Reputation: 616
Apparently - load
from NSBundle
is only there to load executables from a bundle.
From the documentation:
Dynamically loads the bundle’s executable code into a running program, if the code has not already been loaded.
For bundles with only resources it's not necessary to call - load
.
Upvotes: 1