Answer the question
In order to leave comments, you need to log in
How to properly initialize singleton in didFinishLaunchingWithOptions?
Hello, I can’t figure out what the problem is:
there is the most common singleton implementation:
+ (User *)current {
static User *singleton = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
singleton = [[User alloc] init];
});
return singleton;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question