【问题标题】:Can app name for iOS Search be different than CFBundleDisplayName?iOS 搜索的应用名称可以与 CFBundleDisplayName 不同吗?
【发布时间】:2019-04-05 14:27:58
【问题描述】:

我在应用商店中有一个名为“法语翻译+”的应用。

应用图标下方空间不足,无法显示整个名称,因此我设置了 CFBundleDisplayName = "Translator +"。

但是,当我在 iOS 搜索中键入“法语”时,我的应用不会出现在应用部分的结果中。

如何在应用图标下方显示“翻译+”时让 iOS 搜索索引“法语翻译+”?

【问题讨论】:

标签: ios xcode cfbundledisplayname


【解决方案1】:

问题已经在Specify Spotlight keywords iOS 9中回答了

正如您所指出的,Core Spotlight 为应用程序中的数据编制索引。 提供的数据。因此,您需要做的就是向它提供一些数据,以便 Spotlight Search 可以找到您的应用程序。

将此添加到 application(_:didFinishLaunchingWithOptions:) 对我有用:

let attributeSet = CSSearchableItemAttributeSet(itemContentType: "application")
attributeSet.title = "French Translator"
attributeSet.keywords = ["french", "translation", "translator"]
attributeSet.contentDescription = "French Language Translation App"

let item = CSSearchableItem(uniqueIdentifier: "5C0B7719-3BE7-4441-892D-A786AA431BDD", domainIdentifier: nil, attributeSet: attributeSet)
CSSearchableIndex.default().indexSearchableItems([item]) {
  print("Finished indexing with \(String(describing: $0))")
}

【讨论】:

  • 这对数据是正确的。但是,结果显示在下方,而不是在应用程序部分。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-21
  • 2018-04-06
相关资源
最近更新 更多