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;
let set: CSSearchableItemAttributeSet = CSSearchableItemAttributeSet.init(itemContentType: String.init(kUTTypeMovie))
for something that is an info page concerning a certain program in a timetable schedule.import MobileCoreServices
was also needed. The docs are very sparse with this information. – Etiolate