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

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

相关推荐
XiaoCCCcCCccCcccC2 分钟前
C语言实现双向链表
c语言·开发语言·链表
十年一梦实验室5 分钟前
【C++】相机标定源码笔记- RGB 相机与 ToF 深度传感器校准类
开发语言·c++·笔记·数码相机·计算机视觉
Tech Synapse10 分钟前
Java循环创建对象内存溢出怎么解决
java·开发语言·jvm
蜉蝣之翼❉14 分钟前
c++ 简单线程池
开发语言·c++
WHYBIGDATA26 分钟前
Scala中高级的函数编程
开发语言·后端·scala
知识分享小能手31 分钟前
从新手到高手:Scala函数式编程完全指南,Scala 访问修饰符(6)
大数据·开发语言·后端·python·数据分析·scala·函数式编程
点云侠41 分钟前
matlab 干涉图仿真
开发语言·人工智能·算法·计算机视觉·matlab
2401_858425551 小时前
Batch文件中使用tasklist命令:深入掌握进程监控与分析
开发语言·batch
Eiceblue1 小时前
用Python轻松转换Markdown文件为PDF文档
开发语言·vscode·python·pdf·word
杰哥在此1 小时前
Java面试题:解释跨站脚本攻击(XSS)的原理,并讨论如何防范
java·开发语言·面试·编程·xss