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

Raj*_*ajV 6 xcode ios

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

p someVar
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息.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'
Run Code Online (Sandbox Code Playgroud)

核心错误归结为:

error: 'utmp.h' file not found
Run Code Online (Sandbox Code Playgroud)

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

Tro*_*roy 1

太长了;清理你的桥接头并确保你只有你需要的。

我也遇到了同样的问题,但是在failed to get module 'yyy' from AST context. 我从桥接标头中删除了所有内容,然后将项目一一添加回来,以确保我需要所有内容。

我发现#import <UIKit/UIKit.h>在顶部添加是必要的(但最初丢失了),并且发现了一些我不需要的内容,因为我更改了项目结构并忘记删除一些包含内容。之后,它开始工作了。希望这有帮助。