How to show message and video buttons in Corespotlight search?

33 Views Asked by At

I want to show the message and video button when the user searched for a contact I was able to show call button but unable to show a message and video button.

Below is a piece of code which I am using

CSSearchableItemAttributeSet * attributeSet = [[CSSearchableItemAttributeSet alloc]
                                                                   initWithItemContentType:(NSString *)kUTTypeItem];

  attributeSet.displayName = [contact.name.compositeName capitalizedString];
  attributeSet.contentDescription = @"my awesome Contacts ";
  attributeSet.keywords = @[[contact.name.compositeName capitalizedString]];
  UIImage *image = [UIImage imageNamed:@"dialer_filled_icn"];
  NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];
   attributeSet.thumbnailData = imageData;
   attributeSet.phoneNumbers = @[JustNumber([contact.phones[0] number])];
   attributeSet.instantMessageAddresses  = @[JustNumber([contact.phones[0] number])];
   attributeSet.supportsPhoneCall =  @(YES);
   CSSearchableItem *item1 = [[CSSearchableItem alloc]
                             initWithUniqueIdentifier:JustNumber([contact.phones[0] number])
                             domainIdentifier:@"com.domain.appname"
                             attributeSet:attributeSet];

   [[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[item1]
                   completionHandler: ^(NSError * __nullable error) {
                                 if (!error)
                           NSLog(@"Search item(s) journaled for indexing.");
                         }];

Any suggestions would be more appreciated.

0

There are 0 best solutions below