最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - SIRI Custom intent - How to show country list, its more than 50+ countries - Stack Overflow

programmeradmin9浏览0评论

Actually i want to show country list to user and user can select their country but in custom intent siri not going to showing all country list, Please refer screenshot below, thanks in advance

public func resolveCountry(for intent: VASValidationIntent, with completion: @escaping (VASValidationCountryResolutionResult) -> Void) {
    // Check if the country is not yet resolved (i.e., ambiguous)
    guard let country = intent.country else {
        
        // Map the country names to the custom 'Country' object or INObject if it's predefined
        let countryObjects = availableCountriesTen.map { name -> Country in
            let country = Country(identifier: name, display: name)
            return country
        }
        
        // Use the disambiguation response, passing the list of countries for Siri to choose from
        completion(.disambiguation(with: countryObjects))
        return
    }
    
    completion(.success(with: country))
}

发布评论

评论列表(0)

  1. 暂无评论