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

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

相关推荐
多读书1939 分钟前
Java多线程进阶-深入synchronized与CAS
java·开发语言·java-ee
啊阿狸不会拉杆27 分钟前
《算法导论》第 24 章 - 单源最短路径
开发语言·数据结构·c++·算法·php
衍余未了28 分钟前
Centos9傻瓜式linux部署CRMEB 开源商城系统(PHP)
开发语言·php
xzkyd outpaper1 小时前
Kotlin 协程启动方式
android·开发语言·kotlin
集成显卡1 小时前
在JVM跑JavaScript脚本 | 简单 FaaS 架构设计与实现
开发语言·javascript·jvm·设计模式·kotlin·软件开发·faas
数据熊猫Taobaoapi20141 小时前
JavaScript 实现模块懒加载的几种方式
开发语言·javascript·ecmascript
Swift社区2 小时前
Swift 实战:从数据流到不重叠区间的高效转换
开发语言·ios·swift
码农阿豪2 小时前
飞算JavaAI:专为Java开发者打造的智能编程革命
java·开发语言·microsoft
Q_Q19632884752 小时前
python基于Hadoop的超市数据分析系统
开发语言·hadoop·spring boot·python·django·flask·node.js
暮乘白帝过重山2 小时前
负载因子(Load Factor) :哈希表(Hash Table)中的一个关键性能指标
开发语言·数据结构·哈希算法·散列表·负载因子·暮乘白帝过重山