Check OS version before creating downloader

This commit is contained in:
Deadpikle committed 2017-12-20 12:40:48 -05:00
1 parent 429f950434
commit 1cc5f230a5
1 file changed
+6 -1
+6 -1
View File
@@ -283,7 +283,12 @@
withRequest:request];
}
// TODO: SPUDownloaderDeprecated vs SPUDownloaderSession
self.download = [[SPUDownloaderDeprecated alloc] initWithDelegate:self];
if ([SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 9, 0}]) {
self.download = [[SPUDownloaderSession alloc] initWithDelegate:self];
}
else {
self.download = [[SPUDownloaderDeprecated alloc] initWithDelegate:self];
}
SPUURLRequest *urlRequest = [SPUURLRequest URLRequestWithRequest:request];
NSString *desiredFilename = [NSString stringWithFormat:@"%@ %@", [self.host name], [self.updateItem versionString]];
[self.download startPersistentDownloadWithRequest:urlRequest bundleIdentifier:bundleIdentifier desiredFilename:desiredFilename];