diff --git a/CodePush.m b/CodePush.m index 09cec25..071b398 100644 --- a/CodePush.m +++ b/CodePush.m @@ -87,7 +87,7 @@ static NSString *bundleResourceName = @"main"; NSString *packageDate = [currentPackageMetadata objectForKey:BinaryBundleDateKey]; NSString *packageAppVersion = [currentPackageMetadata objectForKey:@"appVersion"]; - if ([[self modifiedDateStringOfFileAtUrl:binaryBundleURL] isEqualToString:packageDate] && ([CodePush isUsingTestConfiguration] ||[binaryAppVersion isEqualToString:packageAppVersion])) { + if ([[self modifiedDateStringOfFileAtURL:binaryBundleURL] isEqualToString:packageDate] && ([CodePush isUsingTestConfiguration] ||[binaryAppVersion isEqualToString:packageAppVersion])) { // Return package file because it is newer than the app store binary's JS bundle NSURL *packageUrl = [[NSURL alloc] initFileURLWithPath:packageFile]; NSLog(logMessageFormat, packageUrl); @@ -397,7 +397,7 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage NSDictionary *mutableUpdatePackage = [updatePackage mutableCopy]; NSURL *binaryBundleURL = [CodePush binaryBundleURL]; if (binaryBundleURL != nil) { - [mutableUpdatePackage setValue:[CodePush modifiedDateStringOfFileAtUrl:binaryBundleURL] + [mutableUpdatePackage setValue:[CodePush modifiedDateStringOfFileAtURL:binaryBundleURL] forKey:BinaryBundleDateKey]; } diff --git a/CodePushPackage.m b/CodePushPackage.m index 4d1300b..4a22430 100644 --- a/CodePushPackage.m +++ b/CodePushPackage.m @@ -229,6 +229,8 @@ NSString * const UnzippedFolderName = @"unzipped"; NSMutableDictionary * mutableUpdatePackage = [updatePackage mutableCopy]; if (isZip) { if ([[NSFileManager defaultManager] fileExistsAtPath:unzippedFolderPath]) { + // This removes any unzipped download data that could have been left + // uncleared due to a crash or error during the download process. [[NSFileManager defaultManager] removeItemAtPath:unzippedFolderPath error:&error]; if (error) {