当我按下“提交”按钮时,应用程序将崩溃。在该View Controller之前,我将隐藏导航控制器。从该视图控制器,我将显示导航控制器。我认为使用导航控制器时出现问题。请帮助我解决此问题。
override func viewDidLoad() {
super.viewDidLoad()
//self.navigationController?.setNavigationBarHidden(false, animated: true)
self.tfName.delegate = self
self.tfPhone.delegate = self
self.tfEmail.delegate = self
}
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(true)
//self.navigationController?.setNavigationBarHidden(false, animated: true)
self.navigationItem.title = "Visitor Details"
}
@IBAction func btnSubmit(_ sender: Any)
{
if tfName.text! == "" || tfEmail.text! == "" || tfPhone.text == "" || imgUser.image == UIImage(named: "chooseImage")
{
let alertController = UIAlertController.alertCtrl(title: "Warning", message: "Please fill all the fields correctly.", buttonTitle: "OK")
self.present(alertController, animated: true, completion: nil)
if !(Utility.validatePhone(value: tfPhone.text!))
{
let alertController = UIAlertController.alertCtrl(title: "Warning", message: "Please enter your phone number correctly.", buttonTitle: "OK")
self.present(alertController, animated: true, completion: nil)
if !(Utility.validateEmail(candidate: tfEmail.text!))
{
let alertController = UIAlertController.alertCtrl(title: "Warning", message: "Please enter your email address correctly.", buttonTitle: "OK")
self.present(alertController, animated: true, completion: nil)
}
}
}
else
{
let confirmUserVC = self.storyboard?.instantiateViewController(withIdentifier: "ConfirmUserVC") as! ConfirmUserVC
self.navigationController?.pushViewController(confirmUserVC, animated: true)
//self.present(confirmUserVC, animated: true, completion: nil)
confirmUserVC.strImg = self.imgUser.image!
confirmUserVC.strName = tfName.text!
confirmUserVC.strPhone = tfPhone.text!
confirmUserVC.strEmail = tfEmail.text!
}
}
控制台显示错误:
2018-01-15 11:18:38.648960 + 0530 DE1 [5465:138738] [MC]延迟加载NSBundle MobileCoreServices.framework 2018年1月15日11:18:38.661549 + 0530DE1 [5465:138738] [MC]已加载MobileCoreServices.framework 2018-01-1511:18:38.683557 + 0530 DE1 [5465:138738] [MC]用于的系统组容器systemgroup.com.apple.configurationprofiles路径为/Users/rahulchopra/Library/Developer/CoreSimulator/Devices/A51E4843-5A2C-4B97-837E-D30EDD015372/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles2018-01-15 11:18:43.519861 + 0530 DE1 [5465:138738] [MC]阅读私人有效用户设置。 2018-01-15 11:18:48.385343 + 0530DE1 [5465:138738] [LayoutConstraints]无法同时满足约束。可能是至少一个约束以下列表是您不想要的。试试这个:(1)看看每个约束并尝试找出您不期望的内容; (2)找到添加了一个或多个不需要的约束并对其进行修复的代码。(“”,“”,”(活动)>“,“”)
将尝试通过打破约束来恢复(有效)>
在UIViewAlertForUnsatisfiableConstraints处设置符号断点在调试器中捕获它。中的方法UIView中列出的UIConstraintBasedLayoutDebugging类别,在可能也有帮助。 2018-01-15 11:18:48.386778 + 0530DigiEntry [5465:138738] [LayoutConstraints]无法同时进行满足约束。可能是至少一个约束以下列表是您不想要的。试试这个:(1)看看每个约束并尝试找出您不期望的内容; (2)找到添加了一个或多个不需要的约束并对其进行修复的代码。(“”,“”,“”,”(活动)>“,”(活动)>“,”(活动)>“,“”)
将尝试通过打破约束来恢复(有效)>
在UIViewAlertForUnsatisfiableConstraints处设置符号断点在调试器中捕获它。中的方法UIView中列出的UIConstraintBasedLayoutDebugging类别,在可能也有帮助。 2018-01-15 11:18:50.587132 + 0530DigiEntry [5465:138738]找不到支持类型5的键盘键盘iPhone-PortraitChoco-PhonePad;使用2024220450015396792_PortraitChoco_iPhone-Complex-Pad_Default2018-01-15 11:19:18.659275 + 0530 DigiEntry [5465:138738][LayoutConstraints]无法同时满足约束。以下列表中的约束中至少有一个是你不要试试这个:(1)查看每个约束并尝试找出你不期望的东西; (2)找到添加了一个或多个不必要的约束并进行修复。 (”(活动)>“,“”,“”,“”,”(活动)>“,“”)
将尝试通过打破约束来恢复(有效)>
在UIViewAlertForUnsatisfiableConstraints处设置符号断点在调试器中捕获它。中的方法UIView中列出的UIConstraintBasedLayoutDebugging类别,在可能也有帮助。 2018-01-15 11:19:18.661432 + 0530DigiEntry [5465:138738] [LayoutConstraints]无法同时进行满足约束。可能是至少一个约束以下列表是您不想要的。试试这个:(1)看看每个约束并尝试找出您不期望的内容; (2)找到添加了一个或多个不需要的约束并对其进行修复的代码。(“”,“”,“”,”(活动)>“,”(活动)>“,”(活动)>“,“”)
将尝试通过打破约束来恢复(有效)>
在UIViewAlertForUnsatisfiableConstraints处设置符号断点在调试器中捕获它。中的方法UIView中列出的UIConstraintBasedLayoutDebugging类别,在可能也有帮助。
也许您可以再次更新iOS或使用Joyoshare UltFix将其降级。也许您不必降级iOS,因为此程序具有修复功能,可在几分钟内修复iPhone。选择此程序的原因是它不会损坏您在手机上的数据。