问题描述
我很新了这一点。我后跟iPhone项目的HelloWorld步苹果的教程一步。我跑了它在iPhone 5.0模拟器坠毁:
I am very new to this. I followed Apple's tutorial step by step for the iPhone project "HelloWorld". I ran it in the iPhone 5.0 simulator and it crashed:
2012-11-02 14:46:06.782 HelloWorld[9880:c07] *** Terminating app due to uncaught
exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate
class named NSLayoutConstraint'
*** First throw call stack:
(0x14a2052 0xea2d0a 0x144aa78 0x144a9e9 0x32f7d7 0x32f9af 0x32f6b7 0x23036d 0xd7e2c 0xd83a9 0xd85cb 0x38a73 0x38ce2 0x38ea8 0x3fd9a 0x10be6 0x118a6 0x20743 0x211f8 0x14aa9 0x138cfa9 0x14761c5 0x13db022 0x13d990a 0x13d8db4 0x13d8ccb 0x112a7 0x12a9b 0x1fed 0x1f15 0x1)
terminate called throwing an exception(lldb)
有人可以告诉我哪里出了问题?我使用的是X code ++ 4.5。
Can someone please tell me what went wrong? I'm using Xcode 4.5.
推荐答案
在默认情况下,当您创建X code ++ 4.5一个新的iOS项目,你的故事板或XIB被设置为使用自动布局,这是一项新功能在iOS中6.0。在 NSLayoutConstraint
类是自动布局系统的一部分,它不会在旧版本的iOS的存在。
By default, when you create a new iOS project in Xcode 4.5, your storyboard or XIB is set to use Autolayout, which is a new feature in iOS 6.0. The NSLayoutConstraint
class is part of the Autolayout system, and it doesn't exist in older versions of iOS.
如果您希望您的应用程序部署到一个老版本的iOS,你需要你的故事板或XIB改变的不的使用自动布局。这是在文件检查器复选框:
If you want to deploy your app to an older version of iOS, you need to change your storyboard or XIB to not use Autolayout. It's a checkbox in the File Inspector:
这篇关于NSInvalidUnarchiveOperationException:无法实例名为NSLayoutConstraint类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!