我一直在寻找这个漏洞的来源几个小时,而且我找到了造成它的线路。错误是Xcode说"发生内部错误。源编辑器功能有限"并且所有语法突出显示都停止工作。每当我输入大约五或六个键或点击输入几次时就会出现错误。
在评论和取消注释代码以找到问题之后,结果就是这一行:
snapshot.value["string here"]
最奇怪的是我在这里使用该代码
// query server for a snapshot of current user's schedule
FirRef.child("\(user!.school)/students").queryOrderedByChild("email")
.queryEqualToValue("(userEmail!)").observeSingleEventOfType(.Value, withBlock: { snapshot in
if let data = snapshot.value as? [String: AnyObject]
{
// create new user model
let newUser = UserModel()
newUser.email = data["email"] as! String
newUser.school = data["school"] as! String
newUser.userId = data["userId"] as! String
newUser.title = ""
newUser.firstName = data["firstName"] as! String
newUser.lastName = data["lastName"] as! String
newUser.firstPeriod = data["firstPeriod"] as! String
newUser.secondPeriod = data["secondPeriod"] as! String
newUser.thirdPeriod = data["thirdPeriod"] as! String
newUser.fourthPeriod = data["fourthPeriod"] as! String
newUser.fifthPeriod = data["fifthPeriod"] as! String
newUser.sixthPeriod = data["sixthPeriod"] as! String
newUser.seventhPeriod = data["seventhPeriod"] as! String
}
})
并且没有问题,但是当我使用此
时// query server for snapshot of any teachers in the user's school
FirRef.child("\(user!.school)/teachers").observeSingleEventOfType(.Value, withBlock: { snapshot in
// iterate through all teachers found
for teacher in snapshot.children
{
// as soon as this line is put in
// Xcode wants to break itself
let thisBreaksStuff = teacher.value["exampleValue"]
}
代码运行良好,并且从服务器中检索我想要的数据没有问题。但是Xcode并不喜欢它。
是的我多次清理项目,重新启动Xcode,重新启动计算机。我甚至删除了Xcode中的派生数据,正如有些人所说的那样