bug-fix: use NSCache instead of NSMutableDictionary avoid thread safe issue.

This commit is contained in:
PonyCui
2017-08-18 16:45:50 +08:00
parent 6bbf771ec2
commit 74e97d3702
2 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
Pod::Spec.new do |s|
s.name = "SVGAPlayer"
s.version = "1.1.2"
s.version = "1.1.3"
s.summary = "SVGAPlayer 是一个高性能的动画播放器"
s.description = <<-DESC
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.homepage = "http://code.yy.com/ued/SVGAPlayer"
s.license = "Private"
s.license = "Apache 2.0"
s.author = { "PonyCui" => "cuiminghui1@yy.com" }

View File

@@ -11,11 +11,11 @@
@implementation SVGABezierPath
- (void)setValues:(nonnull NSString *)values {
static NSMutableDictionary *caches;
static NSCache *caches;
static NSArray *validMethods;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
caches = [NSMutableDictionary dictionary];
caches = [NSCache new];
validMethods = @[@"M",@"L",@"H",@"V",@"C",@"S",@"Q",@"R",@"A",@"Z",@"m",@"l",@"h",@"v",@"c",@"s",@"q",@"r",@"a",@"z"];
});
if ([caches objectForKey:values] != nil) {