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 1
1
Pod ::Spec . new do |s |
2
2
s . name = "MJExtension"
3
- s . version = "3.0.11 "
3
+ s . version = "3.0.12 "
4
4
s . ios . deployment_target = '6.0'
5
5
s . osx . deployment_target = '10.8'
6
6
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
22
22
+ (instancetype )cachedTypeWithCode : (NSString *)code
23
23
{
24
24
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;
31
33
}
32
- return type;
33
34
}
34
35
35
36
#pragma mark - 公共方法
Original file line number Diff line number Diff line change @@ -34,11 +34,13 @@ + (void)load
34
34
35
35
+ (NSMutableDictionary *)dictForKey : (const void *)key
36
36
{
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
+ }
42
44
}
43
45
44
46
+ (void )mj_enumerateClasses : (MJClassesEnumeration)enumeration
Original file line number Diff line number Diff line change @@ -44,12 +44,14 @@ + (void)load
44
44
45
45
+ (NSMutableDictionary *)dictForKey : (const void *)key
46
46
{
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
+ }
53
55
}
54
56
55
57
#pragma mark - --私有方法--
You can’t perform that action at this time.
0 commit comments