2016-10-31 35 views
6

我們已將我們的iOS項目遷移到Swift 3和Xcode 8.從那時起,調試器無法顯示任何變量值。如果我嘗試打印一個變量:Swift 3遷移後無法在調試器中查看變量值

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

TLDR;清理橋頭,確保你只有你需要的東西。

我有同樣的問題,但failed to get module 'yyy' from AST context後沒有輸出。我刪除了橋接頭上的所有內容,並逐個添加項目以確保我需要一切。

我發現在頂部添加#import <UIKit/UIKit.h>是必要的(但最初缺少),並發現了一些我不需要的,因爲我改變了我的項目結構並忘記刪除一些包含。畢竟,它開始工作。希望這有助於。

+0

我有兩個頭文件從橋接頭導入。我需要兩個。評論其中任何一個都會導致編譯問題。 – RajV

+0

我看到了這個想法的早期成功,但問題間歇性地回來。我認爲這個問題是在其他地方,改變豆莢變化足以讓它消失,直到我改變了別的東西。這令人沮喪。 – Troy

+0

好的。在另一個''pod update''之後,一些更多的pod被從Objective C轉換爲Swift 3,因此在清理並向使用這些pod的各種swift文件中添加適當的import語句,然後從pod文件中刪除之後,調試器回來了! – Troy

相關問題