ios - CoreSpotlight Thumbnail Image not showing up on Spotlight search -
i trying make in app content searchable of core spotlight. works great, title , description comes without thumbnail.
here trying:
cssearchableitemattributeset *attributeset = [[cssearchableitemattributeset alloc]initwithitemcontenttype:(nsstring *)kuttypeimage]; attributeset.title = @"my first spotlight search"; attributeset.contentdescription = @"this first spotlight search"; attributeset.keywords = [nsarray arraywithobjects:@"hello", @"welcome",@"spotlight", nil]; uiimage *image = [uiimage imagenamed:@"searchicon.png"]; nsdata *imagedata = [nsdata datawithdata:uiimagepngrepresentation(image)]; attributeset.thumbnaildata = imagedata; cssearchableitem *item = [[cssearchableitem alloc]initwithuniqueidentifier:@"com.deeplink" domainidentifier:@"spotlight.sample" attributeset:attributeset]; [[cssearchableindex defaultsearchableindex] indexsearchableitems:@[item] completionhandler: ^(nserror * __nullable error) { if (!error) nslog(@"search item indexed"); }];
the ios 9 beta 1 release notes state thumbnails aren't yet working search results. see: https://developer.apple.com/library/prerelease/ios/releasenotes/general/rn-iossdk-9.0/index.html
Comments
Post a Comment