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

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

相关推荐
郝学胜-神的一滴19 分钟前
【技术实战】500G单行大文件读取难题破解!生成器+自定义函数最优方案解析
开发语言·python·程序人生·面试
愤豆23 分钟前
02-Java语言核心-语法特性-注解体系详解
java·开发语言·python
是翔仔呐39 分钟前
第13章 SPI通信协议全解:底层时序、4种工作模式与W25Qxx Flash芯片读写实战
c语言·开发语言·stm32·单片机·嵌入式硬件·学习·gitee
2401_878530211 小时前
自定义内存布局控制
开发语言·c++·算法
wjs20241 小时前
SQLite 子查询
开发语言
AndrewMe82111 小时前
detailed-docx:一个能保住格式的 Word 文档操作库
开发语言·python·word
IT方大同1 小时前
RT_thread(RTOS实时操作系统)线程的创建与切换
c语言·开发语言·嵌入式硬件
智算菩萨1 小时前
【OpenGL】6 真实感光照渲染实战:Phong模型、材质系统与PBR基础
开发语言·python·游戏引擎·游戏程序·pygame·材质·opengl
jinanwuhuaguo1 小时前
OpenClaw深度沟通渠道-全景深度解构
大数据·开发语言·人工智能·openclaw
是翔仔呐1 小时前
第14章 CAN总线通信全解:底层原理、帧结构与双机CAN通信实战
c语言·开发语言·stm32·单片机·嵌入式硬件·学习·gitee