简体   繁体   中英

iOS 9 Spotlight Search with CoreSpotlight: cannot replace thumbnail

I am working on a proof of concept about Spotlight Search using a "semi-static" CoreSpotlight db created and replaced on-the-fly when needed.

Here's the code I use for wiping and re-creating the whole stuff (assuming items is a NSArray of CSSearchableItem s):

[[CSSearchableIndex defaultSearchableIndex] deleteAllSearchableItemsWithCompletionHandler:^(NSError * __nullable error){
    if (!error) {
        [[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:items completionHandler:nil];
    }
}];

Almost everything works fine apart from the fact that, if in the process of wiping and rebuilding I try to recreate an item with the same uniqueIdentifier but different thumbnailData (or even no thumbnail at all), it seems to "remember" the thumbnail it was initially created with, and does not acquire the new one.

What's even more curious is that I can replace title , contentDescription and keywords .

Any suggestion would be much appreciated...

This is the bug in the iOS 9, other attributes are updating while thumbnail attribute is not updating . You have to wait for new iOS version may it be fixed in it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM