I am using the CoreSpotLight api to index some content. For some reason I am not able to find the data when I search in the SpotLight.
let atset:CSSearchableItemAttributeSet = CSSearchableItemAttributeSet()
atset.title = "Simple title"
atset.contentDescription = "Simple twitter search"
let item = CSSearchableItem(uniqueIdentifier: "id1", domainIdentifier: "com.shrikar.twitter.search", attributeSet: atset)
CSSearchableIndex.defaultSearchableIndex().indexSearchableItems([item]) { (error) -> Void in
print("Indexed")
}
When I run the app I see that the data is indexed and the error is nil. Also I have added the CoreSpotLight and MobileCoreServices to the build phase.
Try use
itemContentType
initializer like so :The
kUTTypeImage
is declared inMobileCoreServices
.