1. Get info.plist details for your app
Version number: Bundle version
NSString *version = [[[NSBundle Mainbundle] infodictionary] objectforkey:@ "cfbundleversion"];
Application ID: Bundle identifier
NSString *bundleid = [[[NSBundle Mainbundle] infodictionary] objectforkey:@ "Cfbundleidentifier"];
Application Name: Bundle Display Name
NSString *appname = [[NSBundle mainbundle] objectforinfodictionarykey:@ "Cfbundledisplayname"];
Bundle Name
NSString *appname = [[NSBundle mainbundle] objectforinfodictionarykey:@ "Cfbundlename"];
2. Application language localization
APP localization macros
#define Xlocalizedstring (key, comment) [[NSBundle Mainbundle] Localizedstringforkey: (key) value:@ "" Table:nil]
Key-value pairs in two localizable.strings files in English, such as
"None" = "OK";
"None" = "none";
Macro usage: (Return to NSString *)
LocalizedString ("None", "This is a comment")
3. Get the file path and file in the package
Get the App package path
NSString *path = [[NSBundle mainbundle] bundlepath];
App Resource Directory path
NSString *respath = [[NSBundle mainbundle] resourcepath];
Get the Resource directory under A.bundle
nsstring* path = [Respath stringbyappendingpathcomponent:@ "A.bundle"]; NSBundle *bundle = [NSBundle Bundlewithpath:path];
Get the Readme.txt file path for the app package
nsstring *path = [[NSBundle mainbundle] pathforresource:@ "readme" oftype:@ "TXT"];