From 325059484f55907f0e4f5684ffbd3671be65926f Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 27 Aug 2016 23:58:01 -0400 Subject: [PATCH] Only log missing 'length' warning once per all appcast item instances --- Sparkle/SUAppcastItem.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 6a6b6697..87ec4b7a 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -236,7 +236,10 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT if (enclosureLengthString != nil) { contentLength = [enclosureLengthString integerValue]; } else { - SULog(@"warning: <%@> for URL '%@' is missing %@ attribute. Downloading progress may be unreliable. Please always specify %@", SURSSElementEnclosure, [enclosure objectForKey:SURSSAttributeURL], SURSSAttributeLength, SURSSAttributeLength); + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + SULog(@"warning: <%@> for URL '%@' is missing %@ attribute. Downloading progress may be unreliable. Please always specify %@", SURSSElementEnclosure, [enclosure objectForKey:SURSSAttributeURL], SURSSAttributeLength, SURSSAttributeLength); + }); } _contentLength = (contentLength > 0) ? (NSUInteger)contentLength : 0; }