单例的创建

/**  登录后用户信息实体
 * 单例
 */
+(TCMember *)sharedMember{
    static TCMember* shareInstance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        shareInstance = [[self alloc]init];
      
    });
    return shareInstance;
}

原文地址:https://www.cnblogs.com/ygsios/p/4261544.html