If you can target iOS 4.0 or above
Using GCD, is it the best way to create singleton in Objective-C (thread safe)?
+ (instancetype)sharedInstance {
@interface className : NSObject{ +(className*)SingleTonShare; } @implementation className +(className*)SingleTonShare{ static className* sharedObj = nil; static dispatch_once_t once = 0; dispatch_once(&once, ^{ if (sharedObj == nil){ sharedObj = [[className alloc] init]; } }); return sharedObj; }