CSSearchableItemAttributeSet contentType for search results

608 views Asked by At

I'm building an app that uses CSSearchableItemAttributeSet with NSUserActivity in order to add items to the Spotlight Search index. The items I'm indexing are emojis, which consist of the emoji character itself, a description, and an image that shows the emoji. I'm creating an activity and then tying an item attribute set to it, which allows me to specify a thumbnail image.

My question is, in this scenario, what should the content type be for the CSSearchableItemAttributeSet?

I initially thought it should be kUTTypeImage. But the image is not the item being indexed, it's the emoji character. The image only provides supplementary information.

NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:@“com.domain.appname-something"];
activity.title = @“<emoji here>";

CSSearchableItemAttributeSet *contentAttributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage]; //QUESTION: What’s the appropriate contentType?
contentAttributeSet.contentDescription = @"<emoji description here>";
contentAttributeSet.thumbnailData = [self generateEmojiImage];

activity.contentAttributeSet = contentAttributeSet;
0

There are 0 answers