ibireme 8 жил өмнө
parent
commit
093193c67b

+ 2 - 3
YYWebImage/Image/YYAnimatedImageView.m

@@ -124,7 +124,6 @@ typedef NS_ENUM(NSUInteger, YYAnimatedImageType) {
     @package
     UIImage <YYAnimatedImage> *_curAnimatedImage;
     
-    dispatch_once_t _onceToken;
     dispatch_semaphore_t _lock; ///< lock for _buffer
     NSOperationQueue *_requestQueue; ///< image request queue, serial
     
@@ -231,7 +230,7 @@ typedef NS_ENUM(NSUInteger, YYAnimatedImageType) {
 
 // init the animated params.
 - (void)resetAnimated {
-    dispatch_once(&_onceToken, ^{
+    if (!_link) {
         _lock = dispatch_semaphore_create(1);
         _buffer = [NSMutableDictionary new];
         _requestQueue = [[NSOperationQueue alloc] init];
@@ -244,7 +243,7 @@ typedef NS_ENUM(NSUInteger, YYAnimatedImageType) {
         
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
-    });
+    }
     
     [_requestQueue cancelAllOperations];
     LOCK(

+ 4 - 0
YYWebImage/Image/YYImage.m

@@ -212,6 +212,10 @@ static CGFloat _NSStringPathScale(NSString *string) {
     }
 }
 
++ (BOOL)supportsSecureCoding {
+    return  YES;
+}
+
 #pragma mark - protocol YYAnimatedImage
 
 - (NSUInteger)animatedImageFrameCount {

+ 1 - 1
YYWebImage/Image/YYImageCoder.h

@@ -264,7 +264,7 @@ typedef NS_ENUM(NSUInteger, YYImageBlendOperation) {
 
 /**
  Add an image from a file path to encoder.
- @param path     Image file path.
+ @param path    Image file path.
  @param duration Image duration for animation. Pass 0 to ignore this parameter.
  */
 - (void)addImageWithFile:(NSString *)path duration:(NSTimeInterval)duration;

+ 1 - 1
YYWebImage/YYWebImageOperation.m

@@ -368,7 +368,7 @@ static void URLInBlackListAdd(NSURL *url) {
             NSArray *keys = @[NSURLFileSizeKey];
             NSDictionary *attr = [_request.URL resourceValuesForKeys:keys error:nil];
             NSNumber *fileSize = attr[NSURLFileSizeKey];
-            _expectedSize = fileSize ? fileSize.unsignedIntegerValue : -1;
+            _expectedSize = (fileSize != nil) ? fileSize.unsignedIntegerValue : -1;
         }
         
         // request image from web