拉起苹果支付是一个耗时操作,一般都会先唤起HUD提醒用户等待,如果需要在苹果支付的弹窗唤起时隐藏HUD,可以通过绑定系统通知的方式实现。
NotificationCenter.default.addObserver(self, selector: #selector(hideHUD), name: UIApplication.willResignActiveNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(showHUD), name: UIApplication.didBecomeActiveNotification, object: nil)