Speed up app icon load time by 2 seconds by only waiting if it failed

This commit is contained in:
Cameron Gutman 2015-07-12 00:43:20 -07:00
parent 46fe7a8aed
commit 6dbb938368

View File

@ -28,7 +28,9 @@ static const int MAX_ATTEMPTS = 5;
appImage = [UIImage imageWithData:appAssetResp.data]; appImage = [UIImage imageWithData:appAssetResp.data];
self.app.image = UIImagePNGRepresentation(appImage); self.app.image = UIImagePNGRepresentation(appImage);
[NSThread sleepForTimeInterval:RETRY_DELAY]; if (![self isCancelled] && appImage == nil) {
[NSThread sleepForTimeInterval:RETRY_DELAY];
}
} }
[self performSelectorOnMainThread:@selector(sendCallbackForApp:) withObject:self.app waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(sendCallbackForApp:) withObject:self.app waitUntilDone:NO];
} }