Próbuję udostępnić moje treści w aplikacji przy pomocy Core Spotlight. Wszystko działa świetnie, tytuł i opis przychodzi, ale bez miniatury.CoreSpotlight Thumbnail Image nie wyświetla się w trybie Spotlight search
tutaj jest to, co usiłuję:
CSSearchableItemAttributeSet *attributeSet = [[CSSearchableItemAttributeSet alloc]initWithItemContentType:(NSString *)kUTTypeImage];
attributeSet.title = @"My First Spotlight Search";
attributeSet.contentDescription = @"This is my 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");
}];
Używam tego samego kodu, wszystko jest dobrze, ale miniaturka nie działa, szczęście? Dzięki –
@SarojKumarojha jeszcze nie. – Ayush