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等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。

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

相关推荐
ydm_ymz2 分钟前
初阶8 list
c语言·开发语言·数据结构·c++·list
YiHanXii4 分钟前
Axios的二次封装
开发语言·前端
Gvemis⁹14 分钟前
Scala总结(二)
大数据·开发语言·scala
喵手25 分钟前
Java实现视频格式转换的完整指南:从FFmpeg到纯Java方案!
java·开发语言·ffmpeg
观无1 小时前
C# 扩展方法
开发语言·c#
想要成为计算机高手1 小时前
12. STL的原理
开发语言·c++·经验分享·stl
Zz_waiting.1 小时前
多线程 - 线程安全 2 -- > 死锁问题
java·开发语言
Agome991 小时前
linux面试题
java·开发语言·excel
故事与他6451 小时前
电子文档安全管理系统V6.0接口backup存在任意文件下载漏洞
java·开发语言·前端·javascript·安全·网络安全
落榜程序员1 小时前
Java基础-23-静态变量与静态方法的使用场景
java·开发语言