Как показать значок местоположения в центре внимания? - PullRequest
0 голосов
/ 27 марта 2019

Я пытаюсь, чтобы значок местоположения отображался в Spotlight на iOS.

Используя приведенный ниже код, я могу заставить значок телефона отображаться в Spot Light, но не могу отобразить значок карты.

Чего мне не хватает?

Заранее спасибо!

func addToSpotlightIndex(store: StoreLocatons) {

    var searchableItems = [CSSearchableItem]()

    let searchItemAttributeSet = CSSearchableItemAttributeSet(itemContentType: "location")

    searchItemAttributeSet.title = "Closest Store"
    searchItemAttributeSet.namedLocation = store.locationName
    searchItemAttributeSet.contentDescription = "\(store.locationName)\n\(store.locationAddress1)"
    searchItemAttributeSet.supportsPhoneCall = true
    searchItemAttributeSet.supportsNavigation = true
    searchItemAttributeSet.phoneNumbers = [store.phoneNumber1]
    searchItemAttributeSet.longitude = NSNumber(value: store.longitude)
    searchItemAttributeSet.latitude =  NSNumber(value: store.latitude)

    let searchableItem = CSSearchableItem(uniqueIdentifier: store.locationName, domainIdentifier: nil, attributeSet: searchItemAttributeSet)
    searchableItems.append(searchableItem)


    CSSearchableIndex.default().indexSearchableItems(searchableItems) { (error) -> Void in
        if error != nil {
            print(error?.localizedDescription ?? "Error")
        }
    }
}
...