SiriKit Intents UI - Payment Domain - Center Area 重复三次

SiriKit Intents UI - Payment Domain - Center Area is repeated three times

我正在为支付域使用 SiriKit,当用户说 "Send 10 $ to Ronoldo" 时,我的自定义 UI 会显示。
虽然我的自定义视图中只有 1 个标签,但 SiriKit 显示 IntentsUI 因为它有三个与下图相同的标签。
我认为我的观点被重复了 3 次。你能帮忙吗?

我终于解决了这个问题。我的自定义 Siri UI 符合 INUIHostedViewControlling 协议,它定义了 configureView 函数来提供自定义界面。我的视图控制器的每个参数都被调用了很多次,我检查了正确的参数并且 return 我的控制器的视图大小只被调用了 1 次。

希望这对某人有所帮助。

       func configureView(for parameters: Set<INParameter>, of interaction: INInteraction, interactiveBehavior: INUIInteractiveBehavior, context: INUIHostedViewContext, completion: @escaping (Bool, Set<INParameter>, CGSize) -> Void) {

                //.... other codes....

                if (parameters.count > 0) {
                        let startIntentDescriptionParameter = INParameter(for: INSendPaymentIntent.self,
                                                                          keyPath: "currencyAmount")

                        if parameters.contains(startIntentDescriptionParameter) {
                            return completion(true, parameters, self.desiredSize)
                        }
                    }

               return completion(false, parameters, CGSize.zero)

        }

我在我的 project.I 之一中遇到了同样的问题,使用以下方法而不是 configureView 函数来提供自定义界面。

func configure(with interaction: INInteraction!, context: INUIHostedViewContext, completion: ((CGSize) -> Void)!) {
    // your code....
     completion(self.desiredSize)

  }

通过使用这个方法,我的问题得到了解决,我希望它对你也有用。