2016-10-31 15 views
6

Chúng tôi đã di chuyển dự án iOS sang Swift 3 và Xcode 8. Kể từ đó trình gỡ lỗi không thể hiển thị bất kỳ giá trị biến nào. Nếu tôi cố gắng in biến:Không thể xem giá trị biến trong trình gỡ lỗi sau khi di chuyển Swift 3

p someVar 

Tôi nhận được thông báo lỗi này. SchemaManager.h là tiêu đề bắc cầu. (Tên dự án thực tế đã được thay thế bằng yyy dưới đây):

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' 

Lỗi lõi nắm này:

error: 'utmp.h' file not found 

Tôi đã đọc ở đâu đó rằng các vấn đề trong cầu nối tiêu đề có thể ngăn chặn các chương trình gỡ rối hiển thị giá trị biến. Nhưng tôi không chắc chắn làm thế nào tôi đi về sửa chữa vấn đề này cụ thể.

Trả lời

1

TLDR; Làm sạch tiêu đề bắc cầu của bạn và đảm bảo bạn chỉ có những gì bạn cần.

Tôi đã gặp sự cố tương tự nhưng không có đầu ra sau failed to get module 'yyy' from AST context. Tôi đã xóa mọi thứ khỏi tiêu đề bắc cầu và thêm các mục lại một lần để đảm bảo rằng tôi cần mọi thứ.

Tôi thấy rằng việc thêm #import <UIKit/UIKit.h> ở trên cùng là cần thiết (nhưng ban đầu bị thiếu) và tìm thấy một số ít mà tôi không cần khi tôi thay đổi cấu trúc dự án và quên xóa một số nội dung. Sau tất cả, nó bắt đầu hoạt động. Hy vọng rằng điều này sẽ giúp.

+0

Tôi có hai tệp tiêu đề được nhập từ tiêu đề bắc cầu. Tôi cần cả hai. Nhận xét một trong hai nguyên nhân này gây ra các vấn đề biên dịch. – RajV

+0

Tôi thấy thành công ban đầu với ý tưởng này, nhưng vấn đề trở lại không liên tục. Tôi nghĩ rằng vấn đề là ở nơi khác và thay đổi vỏ thay đổi đủ để có nó biến mất cho đến khi tôi thay đổi cái gì khác. Điều này thật khó chịu. – Troy

+0

Ok. Sau khi '' pod update'' khác được chuyển thành Swift 3 từ Objective C, vì vậy sau khi xóa sạch và thêm các câu lệnh import thích hợp vào các tập tin nhanh khác nhau sử dụng các pod đó, và sau đó loại bỏ các tập tin pod, trình gỡ rối đã trở lại! – Troy

Các vấn đề liên quan