0

I am trying to use iCloud in my app. In the simulator, I notice that it takes a short amount of time after launch for new files in iCloud to be added to the ubiquity container. So to refresh my UI to reflect these changes, I set up an NSMetadataQuery as shown:

_query = [[NSMetadataQuery alloc] init];
_query.searchScopes = @[ubiquityContainer];
_query.predicate = [NSPredicate predicateWithFormat:@"%K == '*'", NSMetadataItemFSNameKey];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshFiles) name:NSMetadataQueryDidUpdateNotification object:nil];
[_query startQuery];

refreshFiles is never called...

My app saves its files directly in ubiquityContainer (an NSURL) - it doesn't create any subdirectories...

What am I doing wrong?

Macro206
  • 2,143
  • 3
  • 19
  • 25

1 Answers1

0

I found out what the issue was! I needed to use NSMetadataQueryUbiquitousDataScope as the search scope. That fixed the problem!

Macro206
  • 2,143
  • 3
  • 19
  • 25