Skip to content

Commit

Permalink
Fixed Metadata Query Update Methods
Browse files Browse the repository at this point in the history
Updated NSMetadataQuery notification methods, fixes #64.
  • Loading branch information
Sam Spencer committed Jan 28, 2015
1 parent 2585517 commit 9df53f6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions iCloud/iCloud.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ - (void)enumerateCloudDocuments {
});
}

- (void)startUpdate:(NSMetadataQuery *)query {
- (void)startUpdate:(NSNotification *)notification {
// Log file update
if (self.verboseLogging == YES) NSLog(@"[iCloud] Beginning file update with NSMetadataQuery");

Expand All @@ -243,15 +243,15 @@ - (void)startUpdate:(NSMetadataQuery *)query {
});
}

- (void)recievedUpdate:(NSMetadataQuery *)query {
- (void)recievedUpdate:(NSNotification *)notification {
// Log file update
if (self.verboseLogging == YES) NSLog(@"[iCloud] An update has been pushed from iCloud with NSMetadataQuery");

// Get the updated files
[self updateFiles];
}

- (void)endUpdate:(NSMetadataQuery *)query {
- (void)endUpdate:(NSNotification *)notification {
// Get the updated files
[self updateFiles];

Expand Down Expand Up @@ -302,13 +302,12 @@ - (void)updateFiles {
[self.delegate iCloudFilesDidChange:discoveredFiles withNewFileNames:names];
});
}
}
else if ([fileStatus isEqualToString:NSURLUbiquitousItemDownloadingStatusNotDownloaded]) {
NSError *err;
BOOL downloading = [[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:fileURL error:&err];
} else if ([fileStatus isEqualToString:NSURLUbiquitousItemDownloadingStatusNotDownloaded]) {
NSError *error;
BOOL downloading = [[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:fileURL error:&error];
if (self.verboseLogging == YES) NSLog(@"[iCloud] %@ started downloading locally, successful? %@", [fileURL lastPathComponent], downloading ? @"YES" : @"NO");
if (err) {
if (self.verboseLogging == YES) NSLog(@"[iCloud] Ubiquitous item failed to start downloading with error: %@", err);
if (error) {
if (self.verboseLogging == YES) NSLog(@"[iCloud] Ubiquitous item failed to start downloading with error: %@", error);
}
}
}];
Expand Down

0 comments on commit 9df53f6

Please sign in to comment.