您的位置:首页 > 编程语言

iphone-common-codes-ccteam源代码 CCInfoPlistFileReader.m

2011-12-31 09:59 274 查看
//
//  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


googlecode链接地址(会有更新):http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCInfoPlistFileReader.m
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: