简体   繁体   English

从 iOS 键盘扩展检测来电的认可方法是什么?

[英]What’s the approved way to detect an incoming phone call from an iOS keyboard extension?

How can I detect from an iOS Keyboard Extension if the keyboard is interrupted, for example an incoming phone call.如果键盘中断,例如来电,我如何从 iOS 键盘扩展中检测到。

I have added observers for applicationWillResignActive and applicationDidBecomeActive in UIInputViewController's viewDidLoad .我在 UIInputViewController 的viewDidLoadapplicationWillResignActiveapplicationDidBecomeActive添加了观察者。 I have also added logging in those, plus logging in viewWillAppear and viewWillDisappear .我还添加了这些日志,以及viewWillAppearviewWillDisappear日志。

When I get an incoming phone call with my keyboard displayed -- I do not reliably get applicationWillResignActive , nor do I reliably get viewWillDisappear .当我在显示键盘的情况下接到来电时 - 我不能可靠地获得applicationWillResignActive ,也不能可靠地获得viewWillDisappear

What's the approved way to detect an incoming phone call from an iOS keyboard extension?从 iOS 键盘扩展检测来电的认可方法是什么?

I set Xcode "logging" breakpoints on the observers willResignActive and didBecomeActive to log the name of the breakpoint.我在观察者willResignActivedidBecomeActive上设置了 Xcode“记录”断点以记录断点的名称。 Xcode logged willResignActive every time my phone received a call and didBecomeActive every time the call ended.每次我的手机接到电话时,Xcode 都会记录willResignActive每次电话结束时都会记录didBecomeActive I am realizing that calls to NSLog and "watching for them" in the Console App on my Mac may not be the correct approach.我意识到在我的 Mac 上的控制台应用程序中调用 NSLog 和“监视它们”可能不是正确的方法。 NSLog/Console seems flaky: ie, drops NSLog messages. NSLog/Console 似乎不稳定:即,丢弃 NSLog 消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM