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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...