我收到了command failed due to signal: Segmentation fault: 11?
错误,但对我来说这是非常模糊的原因?它确实在调试器中提供以下响应,但指向以下代码:
1. While type-checking 'textFieldShouldEndEditing' at /Users/macbookair1/Documents/programming/MyApp/MyApp/SignUpViewController.swift:224:5
2. While type-checking expression at [/Users/macbookair1/Documents/programming/MyApp/MyApp/SignUpViewController.swift:231:9 - line:252:11] RangeText="query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) in
if error == nil {
if (objects!.count > 0){
if (UIApplication.sharedApplication().delegate as! AppDelegate).signUpOn {
let myAlert = SCLAlertView().showError("Woah There", subTitle: "username \(textField.text!) is already taken", closeButtonTitle: "Got It")
myAlert.alertview.contentView.backgroundColor = UIColor(red:1.0, green:0.18, blue:0.18, alpha:1.0)
myAlert.alertview.circleBG.backgroundColor = UIColor(red:1.0, green:0.18, blue:0.18, alpha:1.0)
myAlert.alertview.labelTitle.textColor = UIColor.whiteColor()
myAlert.alertview.contentView.layer.borderColor = UIColor(red:1.0, green:0.18, blue:0.18, alpha:1.0).CGColor
myAlert.alertview.viewText.textColor = UIColor.whiteColor()
myAlert.alertview.viewText.backgroundColor = UIColor(red:1.0, green:0.18, blue:0.18, alpha:1.0)
}
} else {
print("Username is available.")
}
} else {
print("error")
}
}"
和另一个指向此代码:
1. While type-checking 'loadBooks' at /Users/macbookair1/Documents/programming/MyApp/MyApp/ThirdCollectionViewController.swift:103:5
2. While type-checking expression at [/Users/macbookair1/Documents/programming/MyApp/MyApp/ThirdCollectionViewController.swift:108:9 - line:127:9] RangeText="query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
self.books.removeAll()
let bookObjects = objects as! [PFObject]
for (_, object) in bookObjects.enumerate() {
self.books.append(Book(pfBook: object))
}
}else if let secondMessage = error?.userInfo["error"] as? String
where secondMessage == "The Internet connection appears to be offline." {
self.failedMessage(secondMessage)
self.activityIndicator.hidden = true
self.activityIndicator.stopAnimating()
}
dispatch_async(dispatch_get_main_queue()){
self.collectionView!.reloadData()
self.refreshControl.endRefreshing()
self.activityIndicator.stopAnimating()
}
}"
如何摆脱此错误?
答案 0 :(得分:0)
这是在编译swift时LLVM本身可能发生的一种错误。 尝试使用替代表达式或使用较新版本的swift(例如编写时的2.0),我遇到过这种情况,某些时候表达式只会导致崩溃,并且分配任务甚至使用objective-c都不会导致崩溃