Permalink
Browse files

Changed TIUbiquityMonitor back to doing a full scan of all cloud file…

…s, because when using the more specialized predicate, it sometimes would not fire notifications (particularly if all URLs were up to date so there were 0 results).
  • Loading branch information...
1 parent 4872c75 commit 30c6ab5d4ccc237276573fb73e01d210df9ffc2b @drewmccormack committed Feb 15, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 TICoreDataSync/06 External Sources/TIUbiquityMonitor.m
@@ -49,7 +49,7 @@ - (id)initWithPredicate:(NSPredicate *)newPredicate
- (id)init
{
- NSPredicate *newPredicate = [NSPredicate predicateWithFormat:@"%K = FALSE OR %K = FALSE", NSMetadataUbiquitousItemIsDownloadedKey, NSMetadataUbiquitousItemIsUploadedKey];
+ NSPredicate *newPredicate = [NSPredicate predicateWithFormat:@"%K like '*'", NSMetadataItemFSNameKey];
return [self initWithPredicate:newPredicate];
}
@@ -114,7 +114,7 @@ - (void)update:(NSNotification *)notif
NSNumber *uploaded = [metadataQuery valueOfAttribute:NSMetadataUbiquitousItemIsUploadedKey forResultAtIndex:i];
NSNumber *fileSizeNumber = [metadataQuery valueOfAttribute:NSMetadataItemFSSizeKey forResultAtIndex:i];
- unsigned long long fileSize = fileSizeNumber.unsignedLongLongValue;
+ unsigned long long fileSize = fileSizeNumber ? fileSizeNumber.unsignedLongLongValue : 0;
if ( downloaded && !downloaded.boolValue ) {
double percentage = percentDownloaded ? percentDownloaded.doubleValue : 0.0;
long long fileDownloadSize = (1.0 - percentage / 100.0) * fileSize;

0 comments on commit 30c6ab5

Please sign in to comment.