问题
I am using corespotlight framework in my OSX application on MacOS 10.13 (17A405) as below:
var searchableItems = [CSSearchableItem]()
let attr = CSSearchableItemAttributeSet(itemContentType: kUTTypeImage as String)
attr.title = "Test item"
attr.contentDescription = "Test item description"
let searchableItem = CSSearchableItem(uniqueIdentifier: "123", domainIdentifier: "com.myapp.search", attributeSet: attr)
searchableItems.append(searchableItem)
CSSearchableIndex.default().indexSearchableItems(searchableItems) { (error) in
if let error = error {
print(error)
}
}
When I run this code I get following error from CSSearchableIndex.default()
Error Domain=CSIndexErrorDomain Code=-1 "(null)"
Any opinion may help...
来源:https://stackoverflow.com/questions/46880821/error-while-using-corespotlight