I have an App called App 1, I changed that name to App 2 on CFBundleDisplayName
and I defined the the search keywords attributes as bellow:
if let displayName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String {
let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeData as String)
attributeSet.title = displayName
attributeSet.contentDescription = ""
attributeSet.keywords = ["App 1", "App 2"]
let item = CSSearchableItem(uniqueIdentifier: "0", domainIdentifier: Bundle.main.bundleIdentifier, attributeSet: attributeSet)
CSSearchableIndex.default().indexSearchableItems([item])
}
When I have the App 1 installed and I update it to App 2 the display name on the home screen is correct, App 2. But When I search for App 1 or App 2 on the Spotlight, the App always shows the old name App 1.
When the App is not installed on the device, and I install the new version App 2 everything works fine, the Spotlight shows the correct name.
Also, when I restart the device everything gets back to normal!
I m not sure how Spotlight works! But is there any cache or something to handle?