Error while using CoreSpotlight

ε祈祈猫儿з 提交于 2019-12-24 07:52:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!