Swift 3迁移后无法在调试器中查看变量值

时间:2016-10-31 19:31:18

标签: ios xcode

我们已将iOS项目迁移到Swift 3和Xcode 8.从那时起,调试器无法显示任何变量值。如果我尝试打印变量:

p someVar

我收到此错误消息。 SchemaManager.h是一个桥接标题。 (实际项目名称已被下面的yyy替换):

warning: Swift error in module yyy.
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module 'yyy' from AST context:
/Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: note: while building module 'SQLiteMacOSX' imported from /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:
#import <sqlite3.h>
        ^

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:10: note: while building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:
#include <stdarg.h>     /* Needed for the definition of va_list */
         ^

<module-includes>:33:9: note: in file included from <module-includes>:33:
#import "util.h"
        ^

error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/util.h:107:10: error: 'utmp.h' file not found with <angled> include; use "quotes" instead
#include <utmp.h>
         ^

/Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: note: while building module 'SQLiteMacOSX' imported from /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:
#import <sqlite3.h>
        ^

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h"
        ^

error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:10: error: could not build module 'Darwin'
#include <stdarg.h>     /* Needed for the definition of va_list */
         ^

/Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h:12:9: note: in file included from /Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h:12:
#import "SchemaManager.h"
        ^

error: /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: error: could not build module 'SQLiteMacOSX'
#import <sqlite3.h>
        ^

error: failed to import bridging header '/Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h'

核心错误归结为:

error: 'utmp.h' file not found

我在其他地方读过,桥接标题中的问题可能会阻止调试器显示变量值。但我不确定如何解决这个问题。

1 个答案:

答案 0 :(得分:1)

TLDR;清理你的桥接头,确保你只有你需要的东西。

我遇到了同样的问题,但在failed to get module 'yyy' from AST context之后没有输出。我从桥接标题中删除了所有内容,然后逐个添加项目以确保我需要一切。

我发现在顶部添加#import <UIKit/UIKit.h>是必要的(但最初缺失)并找到了一些我不需要的东西,因为我改变了我的项目结构而忘记删除一些包含。毕竟,它开始工作。希望这会有所帮助。