Created
November 21, 2014 02:08
-
-
Save unclebean/faa12772248abe241af4 to your computer and use it in GitHub Desktop.
Define static NSDictionary, but when second invoke will be crash. For fixing that we must set "onceToken=0" for pre-invoke getStaticInfo before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NSDictionary *inst = nil; | |
static dispatch_once_t onceToken = 0; | |
+(NSDictionary *) getStaticInfo{ | |
dispatch_once(&onceToken, ^{ | |
inst = @{ | |
@"": @[] | |
}; | |
}); | |
return inst; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment