Permalink
Browse files

Improved a check on the percentage download from iCloud by accounting…

… for possible round-off.
  • Loading branch information...
1 parent 0de0a96 commit c11b30d6fb1f7bfdff855bb3f9b3b209ca5db893 @drewmccormack committed Feb 19, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 TICoreDataSync/06 External Sources/TIUbiquityMonitor.m
@@ -137,7 +137,7 @@ - (void)update:(NSNotification *)notif
// Start download
NSError *error = nil;
- if ( initiateTransfers && percentage == 0.0 && ![fileManager startDownloadingUbiquitousItemAtURL:url error:&error] ) NSLog(@"Failed to initiate download with error: %@", error);
+ if ( initiateTransfers && percentage < 1.e-6 && ![fileManager startDownloadingUbiquitousItemAtURL:url error:&error] ) NSLog(@"Failed to initiate download with error: %@", error);
}
else if ( uploaded && !uploaded.boolValue ) {
double percentage = percentUploaded ? percentUploaded.doubleValue : 0.0;
@@ -146,7 +146,7 @@ - (void)update:(NSNotification *)notif
// Force upload
NSError *error = nil;
- if ( initiateTransfers && percentage == 0.0 && ![fileManager startDownloadingUbiquitousItemAtURL:url error:&error] ) NSLog(@"Failed to initiate upload with error: %@", error);
+ if ( initiateTransfers && percentage < 1.e-6 && ![fileManager startDownloadingUbiquitousItemAtURL:url error:&error] ) NSLog(@"Failed to initiate upload with error: %@", error);
}
}

0 comments on commit c11b30d

Please sign in to comment.