单例

static AppInfo *_instance;


@implementation AppInfo


+ (id)shareAppInfo
{
    if (_instance == nil)
    {
        _instance = [[self alloc]init];
    }
    
    return _instance;
}


+ (id)allocWithZone:(struct _NSZone *)zone
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        _instance = [super allocWithZone:zone];
    });
    
    return _instance;
}


- (id)init
{
    self = [super init];
    if (self)
    {
        self.appUserInfo = nil;

    }
    
    return self;
}

 

posted @ 2015-04-01 13:35  阿哲工具箱diqqxu  阅读(102)  评论(0编辑  收藏  举报