Swift键盘扩展SIGQUIT,执行被中断,原因:EXC_BREAKPOINT

Yan*_*ick 10 ios swift custom-keyboard

当我尝试构建并运行我的键盘扩展时,它有时只会崩溃Thread 1: signal SIGQUIT.

我无法重现错误.有时我可以构建和运行我的应用程序,但大多数时候键盘才会退出.这发生在实际设备上.在模拟器中,它没有打开键盘说Waiting to Attach.

控制台一开始不输出任何错误.但是,如果我在Debug导航器中将下拉列表更改为View UI Hierachy,我会得到以下描述:

Details:  No plist data for fetching view hierarchy: error evaluating expression “(id)[(Class)objc_getClass("DBGViewDebuggerSupport_iOS") fetchViewHierarchyWithOptions:(id)[(Class)objc_getClass("NSDictionary") dictionaryWithObjects:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:1]] arrayByAddingObject:(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:@"_UIVisualEffectBackdropView"] arrayByAddingObject:@"_UIBackdropEffectView"]] arrayByAddingObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:0]] forKeys:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:@"DBGViewDebuggerUseLayersAsSnapshots"] arrayByAddingObject:@"DBGViewDebuggerEffectViewsToSnapshotAsImage"] arrayByAddingObject:@"DBGViewDebuggerAlwaysEncodeLayers"]]]”: error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x18daddc34).
The process has been returned to the state before expression evaluation.

Method:   -[DBGAbstractViewDescriber handleFetchedViewInfo:fetchError:resultHandler:]
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
Run Code Online (Sandbox Code Playgroud)

我还截取了流程的截图.

在此输入图像描述

我做错了什么,怎么能阻止我的键盘扩展在运行时一直退出?它实际上是一个如描述中所述的错误吗?

Ran*_*ndy 2

免责声明

xCode 8.2.1 中的某些内容似乎已损坏,调试器未正确附加到正确的进程,或者托管进程未正确加载新代码。

这不是永久解决方案,而是临时解决方法。

解决方法

我已经能够按照以下步骤解决此问题。

  1. 终止任何正在使用键盘的进程(重要!)
  2. 使用调试器启动应用程序,以便将最新代码部署到设备
  3. 导航到设置 > 常规 > 键盘 > 等。
  4. 删除您的自定义键盘
  5. 重新添加您的自定义键盘
  6. 再次调试应用程序

这样做的原因是删除键盘会杀死托管扩展的进程,从而允许 Xcode 附加到新的二进制文件。