我正在开发基于Siri的支付系统应用程序.我实施了Siri及其工作正常.但我以静态方式添加联系人.但我的要求是,我将从我的服务器获取联系,而不是将其保存在我的扩展中.请建议我如何做到这一点.我正在分享一些代码片段.我的AppDelegate.swift
import UIKit
import Payment
import Intents
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Register names of contacts that may not be in the user's address book.
let contactNames = Contact.sampleContacts.map { $0.formattedName }
INVocabulary.shared().setVocabularyStrings(NSOrderedSet(array: contactNames), of: .contactName)
// Override point for customization after application launch.
return true
}
Run Code Online (Sandbox Code Playgroud)
我的联系班级内付款框架
import Intents
public struct Contact {
private static let nameFormatter = PersonNameComponentsFormatter()
public let nameComponents: PersonNameComponents …Run Code Online (Sandbox Code Playgroud)