Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何删除CSSearchableItemAttributeSet中的thumbnailData_Ios_Swift_Spotlight_Corespotlight - Fatal编程技术网

Ios 如何删除CSSearchableItemAttributeSet中的thumbnailData

Ios 如何删除CSSearchableItemAttributeSet中的thumbnailData,ios,swift,spotlight,corespotlight,Ios,Swift,Spotlight,Corespotlight,我的索引数据没有照片,因此我不想显示照片,我只想要标题和说明: 我已尝试设置: attributes.thumbnailData=nil 但它仍然显示了这张空白图像 static func setupSearchableContentForSpotlight() { let realm = try! Realm(configuration:Constants.realmConfigration.wordsConfigration) var words: Results<W

我的索引数据没有照片,因此我不想显示照片,我只想要标题和说明:

我已尝试设置:

attributes.thumbnailData=nil

但它仍然显示了这张空白图像

static func setupSearchableContentForSpotlight() {
    let realm = try! Realm(configuration:Constants.realmConfigration.wordsConfigration)
    var words: Results<Word>!
    words = realm.objects(Word.self)
    var searchableItems = [CSSearchableItem]()
    words?.forEach { word in
        let attributes = CSSearchableItemAttributeSet(itemContentType: kUTTypeData as String)
        attributes.title = word.defination
        attributes.contentDescription = word.meaning
        attributes.thumbnailData = nil
        let searchableVegetable = CSSearchableItem(uniqueIdentifier: nil, domainIdentifier: nil, attributeSet: attributes)
    }
    CSSearchableIndex.default().indexSearchableItems(searchableItems) { (error) -> Void in
        print("indxing completed")
        UserDefaults.standard.set(true, forKey: "spotLightIndexed")
        if let error = error  {
            print(error.localizedDescription)
        }
    }
}
static func setupSearchableContentForSpotlight(){
让realm=try!realm(配置:Constants.realmconfig.wordsConfigration)
关键词:结果!
words=realm.objects(Word.self)
var searchableItems=[CSSearchableItem]()
单词?.forEach{word in
let attributes=CSSearchableItemAttributeSet(itemContentType:kUTTypeData作为字符串)
attributes.title=word.defination
attributes.contentDescription=word.means
attributes.thumbnailData=nil
让SearchablePlanet=CSSearchableItem(uniqueIdentifier:nil,domainIdentifier:nil,attributeSet:attributes)
}
CSSearchableIndex.default().indexSearchableItems(searchableItems){(错误)->中的Void
打印(已完成)
UserDefaults.standard.set(true,forKey:“spotlightindex”)
如果let error=error{
打印(错误。本地化描述)
}
}
}
例如,我希望结果仅为:

考试

الماس

没有这个空白图像。
注意:该应用程序已具有显示图标。

核心聚光灯结果旁边始终显示图像。如果您不提供缩略图,iOS将显示您的应用程序图标


确保图标集中的图标大小正确。您需要一个40x40图标,标准分辨率为2倍和3倍。

重新启动我的iPhone解决了这个问题


额外提示:如果您正在处理CoreSpotlight,请在重大更改后重新安装iPhone。

它应该显示您的应用程序图标-您的图标中一定缺少一个大小。正如我所说,所有的图标都包括在内。你一定要仔细检查,确保它们没有任何alpha通道。iOS找不到相关图标。现在我重新启动了iPhone,结果旁边的应用图标显示正确,真奇怪。非常感谢。