ios CCInfoPlistFileReader.m

objectivec 复制代码
//
//  CCInfoPlistFileReader.h
//  CCFC
//
//  Created by xichen on 11-12-18.
//  Copyright 2011 ccteam. All rights reserved.
//


#import <Foundation/Foundation.h>
#import "CCPlistFileReader.h"




@interface CCInfoPlistFileReader : CCPlistFileReader
{


}


// not thread safe
+ (id)sharedInstance;
+ (void)releaseInstance;


// print all keys and values in Info.plist file
+ (void)printAllKeysValues;


- (id)init;
- (id)getVersion;


@end
cpp 复制代码
//
//  CCInfoPlistFileReader.m
//  CCFC
//
//  Created by xichen on 11-12-18.
//  Copyright 2011 ccteam. All rights reserved.
//


#import "CCInfoPlistFileReader.h"


static  id      InfoPlistObj;


@implementation CCInfoPlistFileReader


// not thread safe
+ (id)sharedInstance
{
        if(InfoPlistObj == nil)
        {
                @synchronized(self)
                {
                        InfoPlistObj = [[CCInfoPlistFileReader alloc] init];
                }
        }
        return InfoPlistObj;
}


+ (void)releaseInstance
{
        [InfoPlistObj release];
        InfoPlistObj = nil;
}


// print all keys and values in Info.plist file
+ (void)printAllKeysValues
{
        NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];


        for(id key in [infoDict allKeys])
        {
                NSLog(@"key is:%@, value is:%@\n", key, [infoDict objectForKey:key]);
        }
}


- (id)init
{
        self = [super init];
        if(self)
                _internal = [[[NSBundle mainBundle] infoDictionary] retain];
        return self;
}


- (id)getVersion
{
        return [_internal objectForKey:@"CFBundleVersion"]; 
}


@end

微风不燥,阳光正好,你就像风一样经过这里,愿你停留的片刻温暖舒心。

我是程序员小迷(致力于C、C++、Java、Kotlin、Android、Shell、JavaScript、TypeScript、Python等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。

欢迎关注。助您在编程路上越走越好!

相关推荐
老赵的博客2 分钟前
c++ 是静态编译语言
开发语言·c++
Terio_my2 分钟前
Python制作12306查票工具:从零构建铁路购票信息查询系统
开发语言·python·microsoft
消失的旧时光-194325 分钟前
Kotlin when 用法完整分享
android·开发语言·kotlin
万粉变现经纪人25 分钟前
如何解决 pip install -r requirements.txt 约束文件 constraints.txt 仅允许固定版本(未锁定报错)问题
开发语言·python·r语言·django·beautifulsoup·pandas·pip
Fairy_sevenseven38 分钟前
[1]python爬虫入门,爬取豆瓣电影top250实践
开发语言·爬虫·python
珹洺1 小时前
Java-Spring入门指南(二十一)Thymeleaf 视图解析器
java·开发语言·spring
Predestination王瀞潞2 小时前
类的多态(Num020)
开发语言·c++
Predestination王瀞潞2 小时前
类的继承(Num019)
开发语言·c++
万粉变现经纪人2 小时前
如何解决 pip install -r requirements.txt 无效可编辑项 ‘e .‘(-e 拼写错误)问题
开发语言·python·r语言·beautifulsoup·pandas·pip·scipy
say_fall2 小时前
精通C语言(2.结构体)(内含彩虹)
c语言·开发语言·windows