File tree Expand file tree Collapse file tree 4 files changed +24
-19
lines changed Expand file tree Collapse file tree 4 files changed +24
-19
lines changed Original file line number Diff line number Diff line change 11Pod ::Spec . new do |s |
22 s . name = "MJExtension"
3- s . version = "3.0.11 "
3+ s . version = "3.0.12 "
44 s . ios . deployment_target = '6.0'
55 s . osx . deployment_target = '10.8'
66 s . summary = "A fast and convenient conversion between JSON and model"
Original file line number Diff line number Diff line change @@ -22,14 +22,15 @@ + (void)initialize
2222+ (instancetype )cachedTypeWithCode : (NSString *)code
2323{
2424 MJExtensionAssertParamNotNil2 (code, nil );
25-
26- MJPropertyType *type = types_[code];
27- if (type == nil ) {
28- type = [[self alloc ] init ];
29- type.code = code;
30- types_[code] = type;
25+ @synchronized (self) {
26+ MJPropertyType *type = types_[code];
27+ if (type == nil ) {
28+ type = [[self alloc ] init ];
29+ type.code = code;
30+ types_[code] = type;
31+ }
32+ return type;
3133 }
32- return type;
3334}
3435
3536#pragma mark - 公共方法
Original file line number Diff line number Diff line change @@ -34,11 +34,13 @@ + (void)load
3434
3535+ (NSMutableDictionary *)dictForKey : (const void *)key
3636{
37- if (key == &MJAllowedPropertyNamesKey) return allowedPropertyNamesDict_;
38- if (key == &MJIgnoredPropertyNamesKey) return ignoredPropertyNamesDict_;
39- if (key == &MJAllowedCodingPropertyNamesKey) return allowedCodingPropertyNamesDict_;
40- if (key == &MJIgnoredCodingPropertyNamesKey) return ignoredCodingPropertyNamesDict_;
41- return nil ;
37+ @synchronized (self) {
38+ if (key == &MJAllowedPropertyNamesKey) return allowedPropertyNamesDict_;
39+ if (key == &MJIgnoredPropertyNamesKey) return ignoredPropertyNamesDict_;
40+ if (key == &MJAllowedCodingPropertyNamesKey) return allowedCodingPropertyNamesDict_;
41+ if (key == &MJIgnoredCodingPropertyNamesKey) return ignoredCodingPropertyNamesDict_;
42+ return nil ;
43+ }
4244}
4345
4446+ (void )mj_enumerateClasses : (MJClassesEnumeration)enumeration
Original file line number Diff line number Diff line change @@ -44,12 +44,14 @@ + (void)load
4444
4545+ (NSMutableDictionary *)dictForKey : (const void *)key
4646{
47- if (key == &MJReplacedKeyFromPropertyNameKey) return replacedKeyFromPropertyNameDict_;
48- if (key == &MJReplacedKeyFromPropertyName121Key) return replacedKeyFromPropertyName121Dict_;
49- if (key == &MJNewValueFromOldValueKey) return newValueFromOldValueDict_;
50- if (key == &MJObjectClassInArrayKey) return objectClassInArrayDict_;
51- if (key == &MJCachedPropertiesKey) return cachedPropertiesDict_;
52- return nil ;
47+ @synchronized (self) {
48+ if (key == &MJReplacedKeyFromPropertyNameKey) return replacedKeyFromPropertyNameDict_;
49+ if (key == &MJReplacedKeyFromPropertyName121Key) return replacedKeyFromPropertyName121Dict_;
50+ if (key == &MJNewValueFromOldValueKey) return newValueFromOldValueDict_;
51+ if (key == &MJObjectClassInArrayKey) return objectClassInArrayDict_;
52+ if (key == &MJCachedPropertiesKey) return cachedPropertiesDict_;
53+ return nil ;
54+ }
5355}
5456
5557#pragma mark - --私有方法--
You can’t perform that action at this time.
0 commit comments