Browse Source

Some iVersion tweaking!

pull/92/head
Abhishek Banthia 6 years ago
parent
commit
f9e5b77dce
  1. 18
      Clocker/Clocker.xcodeproj/project.pbxproj
  2. 427
      Clocker/Dependencies/iVersion/iVersion.m

18
Clocker/Clocker.xcodeproj/project.pbxproj

@ -921,7 +921,7 @@
TargetAttributes = { TargetAttributes = {
9A7547CF1F184DC3004705EF = { 9A7547CF1F184DC3004705EF = {
CreatedOnToolsVersion = 8.3.2; CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = AJS5SNW8EY; DevelopmentTeam = "-";
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
SystemCapabilities = { SystemCapabilities = {
com.apple.Sandbox = { com.apple.Sandbox = {
@ -1289,7 +1289,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = AJS5SNW8EY; DEVELOPMENT_TEAM = AJS5SNW8EY;
@ -1370,7 +1370,7 @@
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = AJS5SNW8EY; DEVELOPMENT_TEAM = "-";
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = ClockerHelper/Info.plist; INFOPLIST_FILE = ClockerHelper/Info.plist;
@ -1399,10 +1399,10 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CODE_SIGN_ENTITLEMENTS = ClockerHelper/ClockerHelper.entitlements; CODE_SIGN_ENTITLEMENTS = ClockerHelper/ClockerHelper.entitlements;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = AJS5SNW8EY; DEVELOPMENT_TEAM = "-";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
@ -1432,10 +1432,10 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CODE_SIGN_ENTITLEMENTS = ClockerHelper/ClockerHelper.entitlements; CODE_SIGN_ENTITLEMENTS = ClockerHelper/ClockerHelper.entitlements;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = AJS5SNW8EY; DEVELOPMENT_TEAM = "-";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
@ -1703,7 +1703,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = AJS5SNW8EY; DEVELOPMENT_TEAM = AJS5SNW8EY;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -1756,7 +1756,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = AJS5SNW8EY; DEVELOPMENT_TEAM = AJS5SNW8EY;

427
Clocker/Dependencies/iVersion/iVersion.m

@ -443,18 +443,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
return _versionDetails; return _versionDetails;
} }
- (NSString *)URLEncodedString:(NSString *)string
{
CFStringRef stringRef = CFBridgingRetain(string);
CFStringRef encoded = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
stringRef,
NULL,
CFSTR("!*'\"();:@&=+$,/?%#[]% "),
kCFStringEncodingUTF8);
CFRelease(stringRef);
return CFBridgingRelease(encoded);
}
- (void)downloadedVersionsData - (void)downloadedVersionsData
{ {
@ -609,87 +597,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
return YES; return YES;
} }
- (NSString *)valueForKey:(NSString *)key inJSON:(id)json
{
if ([json isKindOfClass:[NSString class]])
{
//use legacy parser
NSRange keyRange = [json rangeOfString:[NSString stringWithFormat:@"\"%@\"", key]];
if (keyRange.location != NSNotFound)
{
NSInteger start = keyRange.location + keyRange.length;
NSRange valueStart = [json rangeOfString:@":" options:(NSStringCompareOptions)0 range:NSMakeRange(start, ((NSString *)json).length - start)];
if (valueStart.location != NSNotFound)
{
start = valueStart.location + 1;
NSRange valueEnd = [json rangeOfString:@"," options:(NSStringCompareOptions)0 range:NSMakeRange(start, ((NSString *)json).length - start)];
if (valueEnd.location != NSNotFound)
{
NSString *value = [json substringWithRange:NSMakeRange(start, valueEnd.location - start)];
value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
while ([value hasPrefix:@"\""] && ![value hasSuffix:@"\""])
{
if (valueEnd.location == NSNotFound)
{
break;
}
NSInteger newStart = valueEnd.location + 1;
valueEnd = [json rangeOfString:@"," options:(NSStringCompareOptions)0 range:NSMakeRange(newStart, ((NSString *)json).length - newStart)];
value = [json substringWithRange:NSMakeRange(start, valueEnd.location - start)];
value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
value = [value stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\""]];
value = [value stringByReplacingOccurrencesOfString:@"\\\\" withString:@"\\"];
value = [value stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
value = [value stringByReplacingOccurrencesOfString:@"\\\"" withString:@"\""];
value = [value stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
value = [value stringByReplacingOccurrencesOfString:@"\\r" withString:@"\r"];
value = [value stringByReplacingOccurrencesOfString:@"\\t" withString:@"\t"];
value = [value stringByReplacingOccurrencesOfString:@"\\f" withString:@"\f"];
value = [value stringByReplacingOccurrencesOfString:@"\\b" withString:@"\f"];
while (YES)
{
NSRange unicode = [value rangeOfString:@"\\u"];
if (unicode.location == NSNotFound || unicode.location + unicode.length == 0)
{
break;
}
uint32_t c = 0;
NSString *hex = [value substringWithRange:NSMakeRange(unicode.location + 2, 4)];
NSScanner *scanner = [NSScanner scannerWithString:hex];
[scanner scanHexInt:&c];
if (c <= 0xffff)
{
value = [value stringByReplacingCharactersInRange:NSMakeRange(unicode.location, 6) withString:[NSString stringWithFormat:@"%C", (unichar)c]];
}
else
{
//convert character to surrogate pair
uint16_t x = (uint16_t)c;
uint16_t u = (c >> 16) & ((1 << 5) - 1);
uint16_t w = (uint16_t)u - 1;
unichar high = 0xd800 | (w << 6) | x >> 10;
unichar low = (uint16_t)(0xdc00 | (x & ((1 << 10) - 1)));
value = [value stringByReplacingCharactersInRange:NSMakeRange(unicode.location, 6) withString:[NSString stringWithFormat:@"%C%C", high, low]];
}
}
return value;
}
}
}
}
else
{
return json[key];
}
return nil;
}
- (void)setAppStoreIDOnMainThread:(NSString *)appStoreIDString - (void)setAppStoreIDOnMainThread:(NSString *)appStoreIDString
{ {
self.appStoreID = appStoreIDString.longLongValue; self.appStoreID = appStoreIDString.longLongValue;
@ -701,10 +608,10 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
{ {
@autoreleasepool @autoreleasepool
{ {
BOOL newerVersionAvailable = NO; __block BOOL newerVersionAvailable = NO;
BOOL osVersionSupported = NO; __block BOOL osVersionSupported = NO;
NSString *latestVersion = nil; __block NSString *latestVersion = nil;
NSDictionary *versions = nil; __block NSDictionary *versions = nil;
//first check iTunes //first check iTunes
NSString *iTunesServiceURL = [NSString stringWithFormat:iVersionAppLookupURLFormat, self.appStoreCountry]; NSString *iTunesServiceURL = [NSString stringWithFormat:iVersionAppLookupURLFormat, self.appStoreCountry];
@ -722,190 +629,153 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
NSLog(@"iVersion is checking %@ for a new app version...", iTunesServiceURL); NSLog(@"iVersion is checking %@ for a new app version...", iTunesServiceURL);
} }
NSError *error = nil; __block NSError *jsonError = nil;
NSURLResponse *response = nil;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:iTunesServiceURL] NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:iTunesServiceURL]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:REQUEST_TIMEOUT]; timeoutInterval:REQUEST_TIMEOUT];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;
if (data && statusCode == 200)
{
//in case error is garbage...
error = nil;
id json = nil;
if ([NSJSONSerialization class])
{
json = [[NSJSONSerialization JSONObjectWithData:data options:(NSJSONReadingOptions)0 error:&error][@"results"] lastObject];
}
else
{
//convert to string
json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}
if (!error)
{
//check bundle ID matches
NSString *bundleID = [self valueForKey:@"bundleId" inJSON:json];
if (bundleID)
{
if ([bundleID isEqualToString:self.applicationBundleID])
{
//get supported OS version
NSString *minimumSupportedOSVersion = [self valueForKey:@"minimumOsVersion" inJSON:json];
#if TARGET_OS_IPHONE
NSString *systemVersion = [UIDevice currentDevice].systemVersion;
#else
NSString *systemVersion = nil;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100
if ([[NSProcessInfo class] respondsToSelector:@selector(processInfo)])
{
NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;
systemVersion = [NSString stringWithFormat:@"%zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion];
}
else
#endif
{
#pragma clang diagnostic push
SInt32 majorVersion = 0, minorVersion = 0, patchVersion = 0;
Gestalt(gestaltSystemVersionMajor, &majorVersion);
Gestalt(gestaltSystemVersionMinor, &minorVersion);
Gestalt(gestaltSystemVersionBugFix, &patchVersion);
systemVersion = [NSString stringWithFormat:@"%d.%d.%d", majorVersion, minorVersion, patchVersion];
#pragma clang diagnostic pop __weak typeof(self) weakSelf = self;
} NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
#endif
osVersionSupported = ([systemVersion compare:minimumSupportedOSVersion options:NSNumericSearch] != NSOrderedAscending); NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
if (!osVersionSupported) completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
{
error = [NSError errorWithDomain:iVersionErrorDomain NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
code:iVersionErrorOSVersionNotSupported
userInfo:@{NSLocalizedDescriptionKey: @"Current OS version is not supported."}]; __strong typeof(self) strongSelf = weakSelf;
}
if (!strongSelf) {
//get version details return;
NSString *releaseNotes = [self valueForKey:@"releaseNotes" inJSON:json]; }
latestVersion = [self valueForKey:@"version" inJSON:json];
if (latestVersion && osVersionSupported) if (error != nil || data == nil) {
{ return;
versions = @{latestVersion: releaseNotes ?: @""}; }
}
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
//get app id
if (!self.appStoreID) if (!jsonError) {
{ //check bundle ID matches
NSString *appStoreIDString = [self valueForKey:@"trackId" inJSON:json]; NSArray *resultsArray = json[@"results"];
[self performSelectorOnMainThread:@selector(setAppStoreIDOnMainThread:) withObject:appStoreIDString waitUntilDone:YES];
if (![resultsArray isKindOfClass:[NSArray class]]) {
if (self.verboseLogging) return;
{ }
NSLog(@"iVersion found the app on iTunes. The App Store ID is %@", appStoreIDString);
} NSDictionary *firstResult = [resultsArray firstObject];
}
if (!firstResult) {
//check for new version return;
newerVersionAvailable = ([latestVersion compareVersion:self.applicationVersion] == NSOrderedDescending); }
if (self.verboseLogging)
{ NSString *bundleID = firstResult[@"bundleId"];
if (newerVersionAvailable)
{ if (![bundleID isKindOfClass:[NSString class]]) {
NSLog(@"iVersion found a new version (%@) of the app on iTunes. Current version is %@", latestVersion, self.applicationVersion); return;
} }
else
{ if (bundleID) {
NSLog(@"iVersion did not find a new version of the app on iTunes. Current version is %@, latest version is %@", self.applicationVersion, latestVersion); if ([bundleID isEqualToString:strongSelf.applicationBundleID])
} {
} //get supported OS version
} NSString *minimumSupportedOSVersion = firstResult[@"minimumOsVersion"];
else
{ if (!minimumSupportedOSVersion || ![minimumSupportedOSVersion isKindOfClass:[NSString class]]) {
if (self.verboseLogging) return;
{ }
NSLog(@"iVersion found that the application bundle ID (%@) does not match the bundle ID of the app found on iTunes (%@) with the specified App Store ID (%@)", self.applicationBundleID, bundleID, @(self.appStoreID));
} NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;
NSString *systemVersion = [NSString stringWithFormat:@"%zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion];
error = [NSError errorWithDomain:iVersionErrorDomain
code:iVersionErrorBundleIdDoesNotMatchAppStore osVersionSupported = ([systemVersion compare:minimumSupportedOSVersion options:NSNumericSearch] != NSOrderedAscending);
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Application bundle ID does not match expected value of %@", bundleID]}]; if (!osVersionSupported)
} {
} error = [NSError errorWithDomain:iVersionErrorDomain
else if (self.appStoreID || !self.remoteVersionsPlistURL) code:iVersionErrorOSVersionNotSupported
{ userInfo:@{NSLocalizedDescriptionKey: @"Current OS version is not supported."}];
if (self.verboseLogging) }
{
NSLog(@"iVersion could not find this application on iTunes. If your app is not intended for App Store release then you must specify a remoteVersionsPlistURL. If this is the first release of your application then it's not a problem that it cannot be found on the store yet"); //get version details
} NSString *releaseNotes = firstResult[@"releaseNotes"];
latestVersion = firstResult[@"version"];
error = [NSError errorWithDomain:iVersionErrorDomain if (latestVersion && osVersionSupported)
code:iVersionErrorApplicationNotFoundOnAppStore {
userInfo:@{NSLocalizedDescriptionKey: @"The application could not be found on the App Store."}]; versions = @{latestVersion: releaseNotes ?: @""};
} }
else if (!self.appStoreID && self.verboseLogging)
{ //get app id
NSLog(@"iVersion could not find your app on iTunes. If your app is not yet on the store or is not intended for App Store release then don't worry about this"); if (!strongSelf.appStoreID)
} {
NSString *appStoreIDString = firstResult[@"trackId"];
//now check plist for alternative release notes [strongSelf performSelectorOnMainThread:@selector(setAppStoreIDOnMainThread:)
if (((self.appStoreID && newerVersionAvailable && osVersionSupported) || !self.appStoreID || self.previewMode) && self.remoteVersionsPlistURL) withObject:appStoreIDString
{ waitUntilDone:YES];
if (self.verboseLogging)
{ if (strongSelf.verboseLogging)
NSLog(@"iVersion will check %@ for %@", self.remoteVersionsPlistURL, self.appStoreID? @"release notes": @"a new app version"); {
} NSLog(@"iVersion found the app on iTunes. The App Store ID is %@", appStoreIDString);
}
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.remoteVersionsPlistURL] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:REQUEST_TIMEOUT]; }
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if (data) //check for new version
{ newerVersionAvailable = ([latestVersion compareVersion:strongSelf.applicationVersion] == NSOrderedDescending);
NSPropertyListFormat format; if (strongSelf.verboseLogging)
NSDictionary *plistVersions = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:&format error:&error]; {
if (newerVersionAvailable)
if (latestVersion) {
{ NSLog(@"iVersion found a new version (%@) of the app on iTunes. Current version is %@", latestVersion, strongSelf.applicationVersion);
//remove versions that are greater than latest in app store }
NSMutableDictionary *versions = [NSMutableDictionary dictionary]; else
for (NSString *version in plistVersions) {
{ NSLog(@"iVersion did not find a new version of the app on iTunes. Current version is %@, latest version is %@", strongSelf.applicationVersion, latestVersion);
if ([version compareVersion:latestVersion] != NSOrderedDescending) }
{ }
versions[version] = plistVersions[version]; }
} else
} {
plistVersions = versions; if (strongSelf.verboseLogging)
} {
if (!latestVersion || plistVersions[latestVersion] || !_useAppStoreDetailsIfNoPlistEntryFound) NSLog(@"iVersion found that the application bundle ID (%@) does not match the bundle ID of the app found on iTunes (%@) with the specified App Store ID (%@)", strongSelf.applicationBundleID, bundleID, @(strongSelf.appStoreID));
{ }
versions = [plistVersions copy];
} error = [NSError errorWithDomain:iVersionErrorDomain
} code:iVersionErrorBundleIdDoesNotMatchAppStore
else if (self.verboseLogging) userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Application bundle ID does not match expected value of %@", bundleID]}];
{ }
NSLog(@"iVersion was unable to download the user-specified release notes"); } else if (strongSelf.appStoreID || !strongSelf.remoteVersionsPlistURL)
} {
} if (strongSelf.verboseLogging)
} {
else if (statusCode >= 400) NSLog(@"iVersion could not find this application on iTunes. If your app is not intended for App Store release then you must specify a remoteVersionsPlistURL. If this is the first release of your application then it's not a problem that it cannot be found on the store yet");
{ }
//http error
NSString *message = [NSString stringWithFormat:@"The server returned a %@ error", @(statusCode)]; error = [NSError errorWithDomain:iVersionErrorDomain
error = [NSError errorWithDomain:@"HTTPResponseErrorDomain" code:statusCode userInfo:@{NSLocalizedDescriptionKey: message}]; code:iVersionErrorApplicationNotFoundOnAppStore
} userInfo:@{NSLocalizedDescriptionKey: @"The application could not be found on the App Store."}];
} }
[self performSelectorOnMainThread:@selector(setDownloadError:) withObject:error waitUntilDone:YES]; else if (!strongSelf.appStoreID && strongSelf.verboseLogging)
[self performSelectorOnMainThread:@selector(setRemoteVersionsDict:) withObject:versions waitUntilDone:YES]; {
[self performSelectorOnMainThread:@selector(setLastChecked:) withObject:[NSDate date] waitUntilDone:YES]; NSLog(@"iVersion could not find your app on iTunes. If your app is not yet on the store or is not intended for App Store release then don't worry about this");
[self performSelectorOnMainThread:@selector(downloadedVersionsData) withObject:nil waitUntilDone:YES]; }
} else {
//http error
NSString *message = [NSString stringWithFormat:@"The server returned a %@ error", @([httpResponse statusCode])];
error = [NSError errorWithDomain:@"HTTPResponseErrorDomain"
code:[httpResponse statusCode]
userInfo:@{NSLocalizedDescriptionKey: message}];
}
[strongSelf performSelectorOnMainThread:@selector(setDownloadError:) withObject:error waitUntilDone:YES];
[strongSelf performSelectorOnMainThread:@selector(setRemoteVersionsDict:) withObject:versions waitUntilDone:YES];
[strongSelf performSelectorOnMainThread:@selector(setLastChecked:) withObject:[NSDate date] waitUntilDone:YES];
[strongSelf performSelectorOnMainThread:@selector(downloadedVersionsData) withObject:nil waitUntilDone:YES];
}];
[dataTask resume];
} }
} }
} }
@ -915,7 +785,8 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
if (!self.checkingForNewVersion) if (!self.checkingForNewVersion)
{ {
self.checkingForNewVersion = YES; self.checkingForNewVersion = YES;
[self performSelectorInBackground:@selector(checkForNewVersionInBackground) withObject:nil]; [self performSelectorInBackground:@selector(checkForNewVersionInBackground)
withObject:nil];
} }
} }

Loading…
Cancel
Save