From d5745743458382ca939a886e6ee9e01cdfc2f591 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Thu, 14 Jun 2018 21:22:26 +0200 Subject: [PATCH 1/2] Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10. Removed __has_feature(objc_generics) check and use generisc to help silence the warnings. --- Autoupdate/AppInstaller.m | 2 +- Autoupdate/SUBinaryDeltaCommon.m | 2 +- Autoupdate/SUBinaryDeltaCreate.m | 26 +++++++-------- Autoupdate/SUDSAVerifier.m | 2 +- Autoupdate/SUPipedUnarchiver.m | 2 +- Configurations/ConfigTestApp.xcconfig | 1 + InstallerConnection/SUInstallerConnection.m | 2 +- .../SUXPCInstallerConnection.m | 8 ++--- InstallerStatus/SUInstallerStatus.m | 4 +-- InstallerStatus/SUXPCInstallerStatus.m | 10 +++--- .../InstallerProgressAppController.m | 2 +- Sparkle/SPUURLRequest.m | 2 +- Sparkle/SPUUpdater.m | 4 +-- Sparkle/SUAppcast.h | 5 --- Sparkle/SUAppcastItem.m | 32 +++++++++---------- Sparkle/SUFileManager.m | 2 +- Sparkle/SUHost.m | 2 +- Sparkle/SUOperatingSystem.m | 2 +- Sparkle/SUStatusController.m | 2 +- Sparkle/SUUpdateAlert.m | 4 +-- Sparkle/SUUpdatePermissionPrompt.h | 2 +- Sparkle/SUUpdatePermissionPrompt.m | 8 ++--- Sparkle/SUUpdater.h | 4 --- Sparkle/SUUpdater.m | 2 +- Sparkle/SUUpdaterDelegate.h | 4 --- TestApplication/SUTestApplicationDelegate.m | 8 ++--- TestApplication/SUTestWebServer.m | 2 +- 27 files changed, 67 insertions(+), 79 deletions(-) diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index b798df38..20cce980 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -376,7 +376,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; return; } - if (![archiveAttributes[NSFileType] isEqualToString:NSFileTypeRegular]) { + if (![(NSString *)archiveAttributes[NSFileType] isEqualToString:NSFileTypeRegular]) { SULog(SULogLevelError, @"Error: Received bad archive file type: %@", archiveAttributes[NSFileType]); [self cleanupAndExitWithStatus:EXIT_FAILURE]; return; diff --git a/Autoupdate/SUBinaryDeltaCommon.m b/Autoupdate/SUBinaryDeltaCommon.m index 8415ca81..1a45fd19 100644 --- a/Autoupdate/SUBinaryDeltaCommon.m +++ b/Autoupdate/SUBinaryDeltaCommon.m @@ -243,7 +243,7 @@ BOOL modifyPermissions(NSString *path, mode_t desiredPermissions) return NO; } mode_t newMode = ([permissions unsignedShortValue] & ~PERMISSION_FLAGS) | desiredPermissions; - int (*changeModeFunc)(const char *, mode_t) = [[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod; + int (*changeModeFunc)(const char *, mode_t) = [(NSString *)[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod; if (changeModeFunc([path fileSystemRepresentation], newMode) != 0) { return NO; } diff --git a/Autoupdate/SUBinaryDeltaCreate.m b/Autoupdate/SUBinaryDeltaCreate.m index 2f3b3fdf..9b923181 100644 --- a/Autoupdate/SUBinaryDeltaCreate.m +++ b/Autoupdate/SUBinaryDeltaCreate.m @@ -156,7 +156,7 @@ static NSString *temporaryPatchFile(NSString *patchFile) static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo) { - unsigned long long fileSize = [newInfo[INFO_SIZE_KEY] unsignedLongLongValue]; + unsigned long long fileSize = [(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue]; if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) { return YES; } @@ -165,11 +165,11 @@ static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary return YES; } - if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { + if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return YES; } - if ([originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) { + if ([(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) { // this is possible if just the permissions have changed return YES; } @@ -183,7 +183,7 @@ static BOOL shouldDeleteThenExtract(NSDictionary *originalInfo, NSDictionary *ne return NO; } - if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { + if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return YES; } @@ -196,11 +196,11 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn return NO; } - if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { + if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return NO; } - if (![originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) { + if (![(NSData *)originalInfo[INFO_HASH_KEY] isEqual:(NSData *)newInfo[INFO_HASH_KEY]]) { return NO; } @@ -213,11 +213,11 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne return NO; } - if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { + if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return NO; } - if ([originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) { + if ([(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) { return NO; } @@ -370,7 +370,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF // We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these // inside an application, and since we don't preserve extended attribitutes anyway - mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue]; + mode_t permissions = [(NSNumber *)info[INFO_PERMISSIONS_KEY] unsignedShortValue]; if (!IS_VALID_PERMISSIONS(permissions)) { if (verbose) { fprintf(stderr, "\n"); @@ -408,7 +408,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } else { newTreeState[key] = info; - if (oldInfo && [oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) { + if (oldInfo && [(NSNumber *)oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [(NSNumber *)info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) { NSArray *parentPathComponents = key.pathComponents; for (NSString *childPath in originalTreeState) { @@ -480,7 +480,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF for (NSString *key in keys) { id value = [newTreeState valueForKey:key]; - if ([value isEqual:[NSNull null]]) { + if ([(NSObject *)value isEqual:[NSNull null]]) { xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1); assert(newFile); xar_prop_set(newFile, DELETE_KEY, "true"); @@ -498,10 +498,10 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF if (shouldChangePermissions(originalInfo, newInfo)) { xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1); assert(newFile); - xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]); + xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]); if (verbose) { - fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]); + fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]); } } } else { diff --git a/Autoupdate/SUDSAVerifier.m b/Autoupdate/SUDSAVerifier.m index eeea9c09..e1b8756d 100644 --- a/Autoupdate/SUDSAVerifier.m +++ b/Autoupdate/SUDSAVerifier.m @@ -34,7 +34,7 @@ return NO; } - SUDSAVerifier *verifier = [[self alloc] initWithPublicKeyData:[pkeyString dataUsingEncoding:NSUTF8StringEncoding]]; + SUDSAVerifier *verifier = [(SUDSAVerifier *)[self alloc] initWithPublicKeyData:[pkeyString dataUsingEncoding:NSUTF8StringEncoding]]; if (!verifier) { return NO; diff --git a/Autoupdate/SUPipedUnarchiver.m b/Autoupdate/SUPipedUnarchiver.m index 3c3e2005..1aa17163 100644 --- a/Autoupdate/SUPipedUnarchiver.m +++ b/Autoupdate/SUPipedUnarchiver.m @@ -100,7 +100,7 @@ // Get the file size. NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil]; - NSUInteger expectedLength = [[attributes objectForKey:NSFileSize] unsignedIntegerValue]; + NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue]; if (expectedLength > 0) { NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath]; diff --git a/Configurations/ConfigTestApp.xcconfig b/Configurations/ConfigTestApp.xcconfig index df4e968e..a1e83d38 100644 --- a/Configurations/ConfigTestApp.xcconfig +++ b/Configurations/ConfigTestApp.xcconfig @@ -6,3 +6,4 @@ ASSETCATALOG_COMPILER_APPICON_NAME = $(SPARKLE_ICON_NAME) LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements +MACOSX_DEPLOYMENT_TARGET = 10.10 diff --git a/InstallerConnection/SUInstallerConnection.m b/InstallerConnection/SUInstallerConnection.m index 89fbd75f..249ad219 100644 --- a/InstallerConnection/SUInstallerConnection.m +++ b/InstallerConnection/SUInstallerConnection.m @@ -91,7 +91,7 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data { - [self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; + [(id)self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; } // This method can be called by us or from a remote diff --git a/InstallerConnection/SUXPCInstallerConnection.m b/InstallerConnection/SUXPCInstallerConnection.m index 2c1e5d7c..efb239bf 100644 --- a/InstallerConnection/SUXPCInstallerConnection.m +++ b/InstallerConnection/SUXPCInstallerConnection.m @@ -57,24 +57,24 @@ self.invalidationBlock = invalidationHandler; __weak SUXPCInstallerConnection *weakSelf = self; - [self.connection.remoteObjectProxy setInvalidationHandler:^{ + [(id)self.connection.remoteObjectProxy setInvalidationHandler:^{ [weakSelf invokeInvalidation]; }]; } - (void)setServiceName:(NSString *)serviceName hostPath:(NSString *)hostPath installationType:(NSString *)installationType { - [self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath installationType:installationType]; + [(id)self.connection.remoteObjectProxy setServiceName:serviceName hostPath:hostPath installationType:installationType]; } - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data { - [self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; + [(id)self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; } - (void)invalidate { - [self.connection.remoteObjectProxy invalidate]; + [(id)self.connection.remoteObjectProxy invalidate]; [self.connection invalidate]; self.connection = nil; } diff --git a/InstallerStatus/SUInstallerStatus.m b/InstallerStatus/SUInstallerStatus.m index af4cc3eb..edad00d6 100644 --- a/InstallerStatus/SUInstallerStatus.m +++ b/InstallerStatus/SUInstallerStatus.m @@ -55,12 +55,12 @@ - (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply { - [self.connection.remoteObjectProxy probeStatusInfoWithReply:reply]; + [(id)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply]; } - (void)probeStatusConnectivityWithReply:(void (^)(void))reply { - [self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; + [(id)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; } // This method can be called by us or from a remote diff --git a/InstallerStatus/SUXPCInstallerStatus.m b/InstallerStatus/SUXPCInstallerStatus.m index 8e67ec0d..0c282d58 100644 --- a/InstallerStatus/SUXPCInstallerStatus.m +++ b/InstallerStatus/SUXPCInstallerStatus.m @@ -50,29 +50,29 @@ self.invalidationBlock = invalidationHandler; __weak SUXPCInstallerStatus *weakSelf = self; - [self.connection.remoteObjectProxy setInvalidationHandler:^{ + [(id)self.connection.remoteObjectProxy setInvalidationHandler:^{ [weakSelf invokeInvalidation]; }]; } - (void)setServiceName:(NSString *)serviceName { - [self.connection.remoteObjectProxy setServiceName:serviceName]; + [(id)self.connection.remoteObjectProxy setServiceName:serviceName]; } - (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply { - [self.connection.remoteObjectProxy probeStatusInfoWithReply:reply]; + [(id)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply]; } - (void)probeStatusConnectivityWithReply:(void (^)(void))reply { - [self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; + [(id)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; } - (void)invalidate { - [self.connection.remoteObjectProxy invalidate]; + [(id)self.connection.remoteObjectProxy invalidate]; [self.connection invalidate]; self.connection = nil; } diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index 9c5a8c95..33a6c4e5 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -135,7 +135,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; [self.statusInfo startListener]; [self.connection resume]; - [self.connection.remoteObjectProxy connectionDidInitiateWithReply:^{ + [(id)self.connection.remoteObjectProxy connectionDidInitiateWithReply:^{ dispatch_async(dispatch_get_main_queue(), ^{ self.connected = YES; }); diff --git a/Sparkle/SPUURLRequest.m b/Sparkle/SPUURLRequest.m index f04f4998..31bbc40a 100644 --- a/Sparkle/SPUURLRequest.m +++ b/Sparkle/SPUURLRequest.m @@ -50,7 +50,7 @@ static NSString *SPUURLRequestNetworkServiceTypeKey = @"SPUURLRequestNetworkServ + (instancetype)URLRequestWithRequest:(NSURLRequest *)request { - return [[[self class] alloc] initWithURL:request.URL cachePolicy:request.cachePolicy timeoutInterval:request.timeoutInterval httpHeaderFields:request.allHTTPHeaderFields networkServiceType:request.networkServiceType]; + return [(SPUURLRequest *)[[self class] alloc] initWithURL:request.URL cachePolicy:request.cachePolicy timeoutInterval:request.timeoutInterval httpHeaderFields:request.allHTTPHeaderFields networkServiceType:request.networkServiceType]; } + (BOOL)supportsSecureCoding diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index 310b2fd6..ac4c3aea 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -727,7 +727,7 @@ static NSString *escapeURLComponent(NSString *str) { const NSTimeInterval oneWeek = 60 * 60 * 24 * 7; sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek); - NSArray *parameters = @[]; + NSArray *> *parameters = @[]; if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) { NSArray *feedParameters = [self.delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]; if (feedParameters != nil) { @@ -743,7 +743,7 @@ static NSString *escapeURLComponent(NSString *str) { // Build up the parameterized URL. NSMutableArray *parameterStrings = [NSMutableArray array]; - for (NSDictionary *currentProfileInfo in parameters) { + for (NSDictionary *currentProfileInfo in parameters) { [parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", escapeURLComponent([[currentProfileInfo objectForKey:@"key"] description]), escapeURLComponent([[currentProfileInfo objectForKey:@"value"] description])]]; } diff --git a/Sparkle/SUAppcast.h b/Sparkle/SUAppcast.h index d7363d0a..4562708e 100644 --- a/Sparkle/SUAppcast.h +++ b/Sparkle/SUAppcast.h @@ -22,12 +22,7 @@ NS_ASSUME_NONNULL_BEGIN SU_EXPORT @interface SUAppcast : NSObject @property (copy, nullable) NSString *userAgentString; - -#if __has_feature(objc_generics) @property (copy, nullable) NSDictionary *httpHeaders; -#else -@property (copy, nullable) NSDictionary *httpHeaders; -#endif - (void)fetchAppcastFromURL:(NSURL *)url inBackground:(BOOL)bg completionBlock:(void (^)(NSError *_Nullable))err; - (SUAppcast *)copyWithoutDeltaUpdates; diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index e71ed2c5..16e7ff70 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -60,8 +60,8 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT if (self != nil) { _deltaUpdates = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [SUAppcastItem class]]] forKey:SUAppcastItemDeltaUpdatesKey]; - _displayVersionString = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDisplayVersionStringKey] copy]; - _DSASignature = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDSASignatureKey] copy]; + _displayVersionString = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDisplayVersionStringKey] copy]; + _DSASignature = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDSASignatureKey] copy]; _fileURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFileURLKey]; _infoURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemInfoURLKey]; @@ -72,12 +72,12 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT return nil; } - _itemDescription = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDescriptionKey] copy]; - _maximumSystemVersion = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMaximumSystemVersionKey] copy]; - _minimumSystemVersion = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy]; + _itemDescription = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDescriptionKey] copy]; + _maximumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMaximumSystemVersionKey] copy]; + _minimumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy]; _releaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemReleaseNotesURLKey]; - _title = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy]; - _versionString = [[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemVersionStringKey] copy]; + _title = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy]; + _versionString = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemVersionStringKey] copy]; _propertiesDictionary = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [NSString class], [NSDate class], [NSArray class]]] forKey:SUAppcastItemPropertiesKey]; } @@ -149,7 +149,7 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT - (BOOL)isCriticalUpdate { - return [[self.propertiesDictionary objectForKey:SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate]; + return [(NSArray *)[self.propertiesDictionary objectForKey:SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate]; } - (BOOL)isMacOsUpdate @@ -191,7 +191,7 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT // Separate the url by underscores and take the last component, as that'll be closest to the end, // then we remove the extension. Hopefully, this will be the version. - NSArray *fileComponents = [[enclosure objectForKey:SURSSAttributeURL] componentsSeparatedByString:@"_"]; + NSArray *fileComponents = [(NSString *)[enclosure objectForKey:SURSSAttributeURL] componentsSeparatedByString:@"_"]; if ([fileComponents count] > 1) { newVersion = [[fileComponents lastObject] stringByDeletingPathExtension]; } @@ -205,9 +205,9 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT } _propertiesDictionary = [[NSDictionary alloc] initWithDictionary:dict]; - _title = [[dict objectForKey:SURSSElementTitle] copy]; - _dateString = [[dict objectForKey:SURSSElementPubDate] copy]; - _itemDescription = [[dict objectForKey:SURSSElementDescription] copy]; + _title = [(NSString *)[dict objectForKey:SURSSElementTitle] copy]; + _dateString = [(NSString *)[dict objectForKey:SURSSElementPubDate] copy]; + _itemDescription = [(NSString *)[dict objectForKey:SURSSElementDescription] copy]; NSString *theInfoURL = [dict objectForKey:SURSSElementLink]; if (theInfoURL) { @@ -250,12 +250,12 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT _fileURL = [NSURL URLWithString:fileURLString]; } if (enclosure) { - _DSASignature = [[enclosure objectForKey:SUAppcastAttributeDSASignature] copy]; + _DSASignature = [(NSString *)[enclosure objectForKey:SUAppcastAttributeDSASignature] copy]; } - _versionString = [newVersion copy]; - _minimumSystemVersion = [[dict objectForKey:SUAppcastElementMinimumSystemVersion] copy]; - _maximumSystemVersion = [[dict objectForKey:SUAppcastElementMaximumSystemVersion] copy]; + _versionString = [(NSString *)newVersion copy]; + _minimumSystemVersion = [(NSString *)[dict objectForKey:SUAppcastElementMinimumSystemVersion] copy]; + _maximumSystemVersion = [(NSString *)[dict objectForKey:SUAppcastElementMaximumSystemVersion] copy]; NSString *shortVersionString = [enclosure objectForKey:SUAppcastAttributeShortVersionString]; if (nil == shortVersionString) { diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index acef794f..92f5f158 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -84,7 +84,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } if (isDirectory != NULL) { - *isDirectory = [[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory]; + *isDirectory = [(NSString *)[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory]; } return YES; diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index a4433472..c1157ce6 100755 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -178,7 +178,7 @@ - (BOOL)boolForInfoDictionaryKey:(NSString *)key { - return [[self objectForInfoDictionaryKey:key] boolValue]; + return [(NSNumber *)[self objectForInfoDictionaryKey:key] boolValue]; } - (id)objectForUserDefaultsKey:(NSString *)defaultName diff --git a/Sparkle/SUOperatingSystem.m b/Sparkle/SUOperatingSystem.m index fada18c3..6cda6499 100644 --- a/Sparkle/SUOperatingSystem.m +++ b/Sparkle/SUOperatingSystem.m @@ -32,7 +32,7 @@ NSURL *url = [coreServices URLByAppendingPathComponent:@"SystemVersion.plist"]; assert(url != nil); NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:url]; - NSArray *components = [ [dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."]; + NSArray *components = [ (NSString *)[dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."]; version.majorVersion = components.count > 0 ? [ [components objectAtIndex:0] integerValue] : 0; version.minorVersion = components.count > 1 ? [ [components objectAtIndex:1] integerValue] : 0; version.patchVersion = components.count > 2 ? [ [components objectAtIndex:2] integerValue] : 0; diff --git a/Sparkle/SUStatusController.m b/Sparkle/SUStatusController.m index 1a012430..b9060c42 100644 --- a/Sparkle/SUStatusController.m +++ b/Sparkle/SUStatusController.m @@ -136,7 +136,7 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; + NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[ SUStatusControllerTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUStatusControllerTouchBarIndentifier; touchBar.delegate = self; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index da21803d..d3320478 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -386,7 +386,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE return finalString; } -- (void)webView:(WebView *)sender didFinishLoadForFrame:frame +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if ([frame parentFrame] == nil) { [self stopReleaseNotesSpinner]; @@ -452,7 +452,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; + NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[SUUpdateAlertTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUUpdateAlertTouchBarIndentifier; touchBar.delegate = self; diff --git a/Sparkle/SUUpdatePermissionPrompt.h b/Sparkle/SUUpdatePermissionPrompt.h index 6c731344..e4477594 100644 --- a/Sparkle/SUUpdatePermissionPrompt.h +++ b/Sparkle/SUUpdatePermissionPrompt.h @@ -18,7 +18,7 @@ + (void)promptWithHost:(SUHost *)host request:(SPUUpdatePermissionRequest *)request reply:(void (^)(SUUpdatePermissionResponse *))reply; - (IBAction)toggleMoreInfo:(id)sender; -- (IBAction)finishPrompt:(id)sender; +- (IBAction)finishPrompt:(NSButton *)sender; @end #endif diff --git a/Sparkle/SUUpdatePermissionPrompt.m b/Sparkle/SUUpdatePermissionPrompt.m index 1868adad..a6cc540d 100644 --- a/Sparkle/SUUpdatePermissionPrompt.m +++ b/Sparkle/SUUpdatePermissionPrompt.m @@ -76,7 +76,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE } if (![NSApp modalWindow]) { // do not prompt if there is is another modal window on screen - SUUpdatePermissionPrompt *prompt = [[[self class] alloc] initPromptWithHost:host request:request reply:reply]; + SUUpdatePermissionPrompt *prompt = [(SUUpdatePermissionPrompt *)[[self class] alloc] initPromptWithHost:host request:request reply:reply]; NSWindow *window = [prompt window]; if (window) { [NSApp runModalForWindow:window]; @@ -86,7 +86,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE - (BOOL)shouldAskAboutProfile { - return [[self.host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue]; + return [(NSNumber *)[self.host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue]; } - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self.host bundlePath]]; } @@ -160,7 +160,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE [self.moreInfoView setHidden:!self.isShowingMoreInfo]; } -- (IBAction)finishPrompt:(id)sender +- (IBAction)finishPrompt:(NSButton *)sender { SUUpdatePermissionResponse *response = [[SUUpdatePermissionResponse alloc] initWithAutomaticUpdateChecks:([sender tag] == 1) sendSystemProfile:self.shouldSendProfile]; self.reply(response); @@ -171,7 +171,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; + NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[SUUpdatePermissionPromptTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUUpdatePermissionPromptTouchBarIndentifier; touchBar.delegate = self; diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index 39174ce0..531e687e 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -162,11 +162,7 @@ SU_EXPORT @interface SUUpdater : NSObject The keys of this dictionary are HTTP header fields (NSString) and values are corresponding values (NSString) */ -#if __has_feature(objc_generics) @property (copy) NSDictionary *httpHeaders; -#else -@property (copy) NSDictionary *httpHeaders; -#endif /*! A property indicating whether or not the user's system profile information is sent when checking for updates. diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 00941547..74ae4748 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -51,7 +51,7 @@ static NSMutableDictionary *sharedUpdaters = nil; if (bundle == nil) bundle = [NSBundle mainBundle]; id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]]; if (updater == nil) { - updater = [[[self class] alloc] initForBundle:bundle]; + updater = [(SUUpdater *)[[self class] alloc] initForBundle:bundle]; } return updater; } diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index 5e9b258e..c508aa98 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -65,11 +65,7 @@ __deprecated_msg("See SPUUpdaterDelegate instead") \return An array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. */ -#if __has_feature(objc_generics) - (NSArray *> *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; -#else -- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; -#endif /*! Returns a custom appcast URL. diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index bb0b2dc2..70a87146 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -31,7 +31,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; NSBundle *mainBundle = [NSBundle mainBundle]; // Check if we are already up to date - if ([[mainBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey] isEqualToString:UPDATED_VERSION]) { + if ([(NSString *)[mainBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey] isEqualToString:UPDATED_VERSION]) { NSAlert *alreadyUpdatedAlert = [[NSAlert alloc] init]; alreadyUpdatedAlert.messageText = @"Update succeeded!"; alreadyUpdatedAlert.informativeText = @"This is the updated version of Sparkle Test App.\n\nDelete and rebuild the app to test updates again."; @@ -117,7 +117,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; NSString *zipName = @"Sparkle_Test_App.zip"; NSTask *dittoTask = [[NSTask alloc] init]; dittoTask.launchPath = @"/usr/bin/ditto"; - dittoTask.arguments = @[@"-c", @"-k", @"--sequesterRsrc", @"--keepParent", destinationBundleURL.lastPathComponent, zipName]; + dittoTask.arguments = @[@"-c", @"-k", @"--sequesterRsrc", @"--keepParent", (NSString *)destinationBundleURL.lastPathComponent, zipName]; dittoTask.currentDirectoryPath = serverDirectoryPath; [dittoTask launch]; [dittoTask waitUntilExit]; @@ -138,7 +138,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; signUpdateTask.launchPath = signUpdatePath; NSURL *archiveURL = [serverDirectoryURL URLByAppendingPathComponent:zipName]; - signUpdateTask.arguments = @[archiveURL.path, privateKeyPath]; + signUpdateTask.arguments = @[(NSString *)archiveURL.path, privateKeyPath]; NSPipe *outputPipe = [NSPipe pipe]; signUpdateTask.standardOutput = outputPipe; @@ -221,7 +221,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; codeSignConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(TestAppHelperProtocol)]; [codeSignConnection resume]; - [codeSignConnection.remoteObjectProxy codeSignApplicationAtPath:applicationPath reply:^(BOOL success) { + [(id)codeSignConnection.remoteObjectProxy codeSignApplicationAtPath:applicationPath reply:^(BOOL success) { assert(success); [codeSignConnection invalidate]; diff --git a/TestApplication/SUTestWebServer.m b/TestApplication/SUTestWebServer.m index 2ca31e8e..47a4ab09 100644 --- a/TestApplication/SUTestWebServer.m +++ b/TestApplication/SUTestWebServer.m @@ -96,7 +96,7 @@ NSString *requestLine = lines.count >= 3 ? [lines objectAtIndex:0] : nil; NSArray *parts = requestLine ? [requestLine componentsSeparatedByString:@" "] : nil; // Only process GET requests for existing files - if ([[parts objectAtIndex:0] isEqualToString:@"GET"]) { + if ([(NSString *)[parts objectAtIndex:0] isEqualToString:@"GET"]) { // Use NSURL to strip out query parameters NSString *path = [NSURL URLWithString:[parts objectAtIndex:1] relativeToURL:nil].path; NSString *filePath = [self.workingDirectory stringByAppendingString:path]; From 4bcaee7213a442e4fed1f6eb442bc55f0718b183 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Thu, 14 Jun 2018 21:02:45 +0200 Subject: [PATCH 2/2] Updated readme to indicate Xcode 7 or later is required. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 940e78ed..094a7c25 100644 --- a/README.markdown +++ b/README.markdown @@ -64,7 +64,7 @@ New Sparkle classes are now prefixed with `SPU` rather than `SU`. Older classes ## Requirements * Runtime: **macOS 10.9** or greater for 64bit, **macOS 10.10** or greater for 32bit (this has been bumped up!) -* Build: At least Xcode 6. Xcode 7 or greater recommended. +* Build: Xcode 7 or greater required. * HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/)) ## Usage