微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

xcode – 在REPL中创建目标Swift AST上下文时出错((null))

在这里,我已经看到有关这个错误的几个(好的,不是很多,但是很少)的问题,但是没有一个提出的解决方案适用于我.这是我得到的
$swift
Welcome to Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81). Type :help for assistance.
warning: Swift error in module repl_swift: 
    Error creating module Swift AST context: Couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module dyld: 
    Error creating module Swift AST context: Couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module CoreFoundation: 
    Error creating module Swift AST context: Couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.

...

warning: Swift error in module ServiceManagement: 
    Error creating module Swift AST context: Couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module libxslt.1.dylib: 
    Error creating module Swift AST context: Couldn't get a ClangImporter
Debug info from this module will be unavailable in the debugger.

error: Error creating target Swift AST context: (null)

这可能是也可能没有发生在我发出一些我不记得的命令之后(我的黑社会历史没有太大帮助).奇怪的是,如果我卸载Xcode,REPL开始正常工作.但是,如果我重新安装Xcode,错误就会回来.我在Xcode 7.2.1(7C1002),顺便说一句.思考?

解决方法

要查看当前的Xcode路径:

xcode-select -p

我是一条老路:

/Applications/Xcode.app/Contents/Developer

然后通过以下方式更新此路径:

sudo xcode-select -s / Library / Developer / CommandLinetools

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐