我无法在 SFSafariViewController 上拦截触摸事件。
这是我的 Main.swift
文件
UIApplicationMain(CommandLine.argc,CommandLine.unsafeArgv,
NSStringFromClass(MyApplication.self), NSStringFromClass(AppDelegate.self))
另外,这里是 UIApplication 的子类
class MyApplication: UIApplication
{
override func sendEvent(_ event: UIEvent)
{
super.sendEvent(event)
let allTouches = event.allTouches;
if (allTouches != nil && allTouches?.count > 0)
{
print("reset called")
MyTimeManager.sharedTimeManager.resetActivityTimer()
}
}
}
我的问题是当用户在 SFSafariViewController 的实例中时;上面定义的 sendEvent
func 没有被调用。
有人知道如何实现吗?