iOS 单例

    +(SchoolManager *)sharedInstance  
    {  
        __strong static SchoolManager *sharedManager;  
          
        static dispatch_once_t onceToken;  
        dispatch_once(&onceToken, ^{  
            sharedManager = [[SchoolManager alloc] init];  
        });  
          
        return sharedManager;  
    }  

你可能感兴趣的:(ios)