xcode iOS 10:如何调试 Today 小部件 - “无法加载”消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41347790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iOS 10: How to debug a Today Widget - "Unable to load" message
提问by adamsfamily
It seems to me that whenever a Today Widget crashes for any reason it displays the "Unable to load" message (as on the attached screen).
在我看来,每当 Today Widget 因任何原因崩溃时,它都会显示“无法加载”消息(如附加屏幕所示)。
When this happens nothing kicks off in the debugger, nothing appears on the Console. It seems to me like searching for a needle in the haystack. Is it possibl to debug the "Unable to load" message in Xcode in any way?
发生这种情况时,调试器中不会启动任何内容,控制台上也不会显示任何内容。在我看来,这就像大海捞针。是否可以以任何方式调试 Xcode 中的“无法加载”消息?
Xcode version: 8.2
Xcode 版本:8.2
iOS Simulator: 10.2
iOS 模拟器:10.2
回答by Juan Curti
You can debug you Today Extension by doing the following:
您可以通过执行以下操作来调试 Today Extension:
With the application running in your device/simulator, open the widget. Then, when you have your widget open, go to Xcode->Debug->Attach to Process and you should find your widget name.
当应用程序在您的设备/模拟器中运行时,打开小部件。然后,当您打开小部件时,转到 Xcode->Debug->Attach to Process,您应该会找到您的小部件名称。
Note this will only work if you have your widget opened. You can set breakpoints and debug step by step to find out why the "Unable to Load" message appears.
请注意,这仅在您打开小部件时才有效。您可以设置断点并逐步调试以找出出现“无法加载”消息的原因。