Tôi đang cố gắng làm cho nội dung ứng dụng của tôi có thể tìm kiếm được với sự trợ giúp của Core Spotlight. Tất cả mọi thứ hoạt động tuyệt vời, tiêu đề và mô tả đến nhưng không có hình thu nhỏ.Hình ảnh thu nhỏ của CoreSpotlight không hiển thị trên tìm kiếm Spotlight
đây là những gì tôi đang cố gắng:
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");
}];
Tôi đang sử dụng cùng một mã, mọi thứ đều đẹp nhưng hình thu nhỏ không hoạt động, bất kỳ may mắn nào @Ayush? Cảm ơn –
@SarojKumarojha chưa. – Ayush