Come cercare i file caricati in iCloud
Domanda
sono riuscito a caricare un file su iCloud, che può essere visto all'interno di gestire lo spazio icloud (ma, cosa strana è il nome del file è 'sconosciuto').
Inoltre ho trovato un pezzo di codice dal documento Apple
_query = [[NSMetadataQuery alloc] init];
[_query setSearchScopes:[NSArray arrayWithObjects:NSMetadataQueryUbiquitousDataScope, nil]];
[_query setPredicate:[NSPredicate predicateWithFormat:@"%K == '*.*'", NSMetadataItemFSNameKey]];
NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(fileListReceived)
name:NSMetadataQueryDidFinishGatheringNotification object:nil];
[notificationCenter addObserver:self selector:@selector(fileListReceived)
name:NSMetadataQueryDidUpdateNotification object:nil];
[_query startQuery];
//
[super viewDidLoad];
-(void)fileListReceived
{
NSArray* queryResults = [_query results];
for (NSMetadataItem* result in queryResults) {
NSString* fileName = [result valueForAttribute:NSMetadataItemFSNameKey];
NSLog(@"fileName = %@", fileName);
}
}
, ma il risultato è sempre 0, non importa NSMetadataQueryUbiquitousDataScope o NSMetadataQueryUbiquitousDocumentsScope.
So anche che icloud ha funzione di backup, così fa il backup ha alcuna relazione con il caricamento di file da app per sé?
Soluzione
In your predicate try to use "like" instead of "==".
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow