zoukankan      html  css  js  c++  java
  • 从info.plist获取项目名称及其它

    NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey];


        NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];

     

    还有其它很多信息可由infoDictionary获得,以下是官方文档里的说明:

    information Property List Keys
    Standard keys found in a bundle’s information property list file.

    const CFStringRef kCFBundleInfoDictionaryVersionKey;
    const CFStringRef kCFBundleExecutableKey;
    const CFStringRef kCFBundleIdentifierKey;
    const CFStringRef kCFBundleVersionKey;
    const CFStringRef kCFBundleDevelopmentRegionKey;
    const CFStringRef kCFBundleNameKey;
    const CFStringRef kCFBundleLocalizationsKey;


    Constants
    kCFBundleInfoDictionaryVersionKey
    The version of the information property list format.
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    kCFBundleExecutableKey
    The name of the executable in this bundle (if any).
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    kCFBundleIdentifierKey
    The bundle identifier.
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    kCFBundleVersionKey
    The version number of the bundle.
    For Mac OS 9 style version numbers (for example “2.5.3d5”), clients can use CFBundleGetVersionNumber instead of accessing this key directly since that function will properly convert the version string into its compact integer representation.
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    kCFBundleDevelopmentRegionKey
    The name of the development language of the bundle.
    When CFBundle looks for resources, the fallback is to look in the lproj whose name is given by the kCFBundleDevelopmentRegionKey in the Info.plist file. You must, therefore, ensure that a bundle contains an lproj with that exact name containing a copy of every localized resource, otherwise CFBundle cannot guarantee the fallback mechanism will work.
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    kCFBundleNameKey
    The human-readable name of the bundle.
    This key is often found in the InfoPlist.strings since it is usually localized.
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    kCFBundleLocalizationsKey
    Allows an unbundled application that handles localization itself to specify which localizations it has available.
    Available in iOS 2.0 and later.
    Declared in CFBundle.h.
    Declared In
    CFBundle.h

  • 相关阅读:
    在子线程中使用Toast
    时间戳与字符串的转换
    Notification小案例
    Android文件的读写操作
    SmartImageView-网络图片查看器
    JavaScript中判断对象类型的种种方法
    nodejs npm常用命令
    web前端安全机制问题全解析
    Gulp安装及配合组件构建前端开发一体化(转)
    gulp 实现 js、css,img 合并和压缩(转)
  • 原文地址:https://www.cnblogs.com/neworiginou/p/2770183.html
Copyright © 2011-2022 走看看