libc ++ abi.dylib:以NSException(lldb)types的未捕获exception终止

我正在快速编程一个应用程序,当我在iPhone模拟器上运行testing应用程序时,一切正常,但是我尝试向右滑动,这是我为其添加的一个手势,以便进入下一页(View Controller Two)它崩溃并在控制台日志中显示此错误报告。

2014-10-18 12:07:34.400 soundtest[17081:818922] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<soundtest.ViewControllerTwo 0x7f92f1f20090> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key sfdfa.' *** First throw call stack: ( 0 CoreFoundation 0x00000001067813f5 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001082afbb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000106781039 -[NSException raise] + 9 3 Foundation 0x0000000106b984d3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 4 CoreFoundation 0x00000001066cb400 -[NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x00000001072ce97d -[UINib instantiateWithOwner:options:] + 1506 6 UIKit 0x000000010712f698 -[UIViewController _loadViewFromNibNamed:bundle:] + 242 7 UIKit 0x000000010712fc88 -[UIViewController loadView] + 109 8 UIKit 0x000000010712fef9 -[UIViewController loadViewIfRequired] + 75 9 UIKit 0x000000010713038e -[UIViewController view] + 27 10 UIKit 0x00000001076cd83f -[_UIFullscreenPresentationController _setPresentedViewController:] + 65 11 UIKit 0x000000010710bc49 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 105 12 UIKit 0x000000010713c121 -[UIViewController _presentViewController:withAnimationController:completion:] + 1746 13 UIKit 0x000000010713e461 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 132 14 UIKit 0x000000010713e385 -[UIViewController presentViewController:animated:completion:] + 229 15 UIKit 0x00000001073bb9d6 _UIGestureRecognizerSendActions + 262 16 UIKit 0x00000001073ba679 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 532 17 UIKit 0x00000001073bf296 ___UIGestureRecognizerUpdate_block_invoke662 + 51 18 UIKit 0x00000001073bf192 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 254 19 UIKit 0x00000001073b520d _UIGestureRecognizerUpdate + 2796 20 UIKit 0x00000001070520a6 -[UIWindow _sendGesturesForEvent:] + 1041 21 UIKit 0x0000000107052cd3 -[UIWindow sendEvent:] + 667 22 UIKit 0x000000010701fae1 -[UIApplication sendEvent:] + 246 23 UIKit 0x000000010702cbad _UIApplicationHandleEventFromQueueEvent + 17370 24 UIKit 0x0000000107008233 _UIApplicationHandleEventQueue + 1961 25 CoreFoundation 0x00000001066b6ad1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 26 CoreFoundation 0x00000001066ac99d __CFRunLoopDoSources0 + 269 27 CoreFoundation 0x00000001066abfd4 __CFRunLoopRun + 868 28 CoreFoundation 0x00000001066aba06 CFRunLoopRunSpecific + 470 29 GraphicsServices 0x000000010a1699f0 GSEventRunModal + 161 30 UIKit 0x000000010700b550 UIApplicationMain + 1282 31 soundtest 0x000000010624503e top_level_code + 78 32 soundtest 0x000000010624507a main + 42 33 libdyld.dylib 0x000000010ae4a145 start + 1 34 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) 

CMYR – “如果你将一个button连接到一个不存在的IBAction(或者已经被重命名),他也可能发生”

如果您遇到这个问题,请确保您转到Main.storyboard,右键单击电话轮廓顶部的黄色框图标(视图控制器),然后用黄色标记删除sockets。

在这种情况下会发生什么,你可能会命名为一个动作,然后重命名它。 你需要删除旧名称,如果这是唯一的问题将开始在SIM卡!

在这里输入图像描述

其他解决scheme没有形成我的工作,这是我的。 它在Swift 2.3遗留模式下运行时仅适用于Xcode 8

看起来像Interface Builder试图重命名应该连接到button的方法。

这是一个更详细的雷达 。

解决scheme(解决方法)是手动将方法参数名称replace为_

 @IBAction func editPictureTapped(sender: UIButton) { // not working print("Tapped") } 

更改为:

 @IBAction func editPictureTapped(_: UIButton) { // working OK print("Tapped") } 

这也可能是错误的Segue标识符名称。 例如 –

 performSegueWithIdentifier("wrongSegueName", sender: self) 

Xcode 7开始发生这种情况,我没有可以删除的黄旗的插口。

唯一对我有用的是在AppDelegate中replace这一行:

 [window addSubview:viewController.view]; 

至:

 [window setRootViewController:viewController]; 

对我来说,这个问题是在我的IBAction与UIButton。

当你用Ctrl + Drag来从UIButton创build一个IBAction的时候,一定要从Type下拉列表中select“UIButton”。 AnyObject的默认select会导致应用程序在您点击UIButton时崩溃。

在这里输入图像描述

我的情况有点不同,我试图插入到一个UINavigationController ,并为我解决这个问题是主队列的一部分。

对于Objective-C:

 dispatch_async(dispatch_get_main_queue(), ^{ [self performSegueWithIdentifier:@"SegueName" sender:self]; }); 

对于Swift 3:

 DispatchQueue.main.async { [weak self] in self?.performSegue(withIdentifier: "SegueName", sender: self) } 

我遇到了这个问题,当我改变连接到我的一个button的variables的名称。 所以请记住!

我是Xcode的新手,所以花了我几个小时才找出加载xls文件的问题。 我跟随了大部分示例代码,没有一个解决了Xcode显示的错误。

我find的解决scheme是,我们需要指定“添加到目标:”勾选要添加的项目,当我们通过拖放到项目 – >支持文件导入xls文件到Xcode。

你的视图控制器中的一个button可能会有超过1个IBAction,试着find这些button,并删除控制器中该button的所有以前的项目,并创build新的button,它将解决你的问题。

我将把我的问题添加到可能的解决scheme列表中,以防其他人在这个线程中发生。

TableView单元格标识符。 首先确保你的单元有一个标识符。 其次,确保在您将单元出列时引用该标识符。

确保您不是dynamic地将相对约束应用于视图层次结构中尚不存在的视图。

 UIView *bottomView = [[UIView alloc] initWithFrame:CGRectZero]; [self.view addSubview:bottomView]; bottomConstraint = [NSLayoutConstraint constraintWithItem:bottomView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; bottomConstraint.active = YES; 

在上面的例子中,在应用相对约束之前, bottomView已经成为视图层次结构的一部分。

在我的情况下,它是iPad上的UIAlertView: UIAlertController崩溃(iPad) 。 我没有安装sourceView和sourceRect。

对于我的情况, Xcode 8.2.1 ,我有一个视图控制器中的地图工具包视图 。 所以我去了

build立阶段>与库链接二进制文件

并添加MapKit.framework ,那就很好了。

我认为这也适用于其他需要框架的观点。

PS在iOS 9上运行告诉我有一个关于Map Kit View的问题,而在iOS 10上却没有告诉我任何东西!

只有“下降大决战”的解决scheme为我工作:

  • 从设备中移除应用
  • 清洁的项目
  • 在设备上运行新的安装

在我的情况下,由于断言失败(这是由我们的代码设置的),XCode感到疲惫,无法启动应用程序。

在其他设备上运行显示断言失败,我们可以修复,一切恢复正常。

我有以下两种方式得到这个错误:

我在推入另一个UIViewController时遇到了这个错误。

但是,我错误地从UITabBarController子类别,并得到这个错误。

我如何解决? 我从UIViewController subclassed,我不再崩溃:)


我不想使用故事板。 所以我删除了它。 但是我忘了在项目设置中删除它的引用。 我只是点击了项目>>常规>>部署信息>>然后我将主界面设置为黑色空间。 (之前设置为主)

正如你所看到的这两种情况下,您访问某个对象,确实存在一个错误…

对于Swift 2.3

这似乎是Xcode 8和Swift 2.3的一个bug,如果你通过storyboard连接button动作到你的代码,请确保Xcode没有重命名动作,对我来说,它添加了一个withSender:在方法的最后,所以我所做的是去我的代码和重命名的方法来匹配一个Xcode写的。

对于任何其他版本检查正确的答案。

Swift 4

我得到这个错误,因为在UIVisualEffectView API的变化。 在Swift 3中可以这样做: myVisuallEffectView.addSubview(someSubview)

但在Swift 4中,我必须将其更改为: myVisualEffectView.contentView.addSubview(someSubview)

在我的情况下,它是InterfaceBuilder。 我从另一个ViewController复制了一些视图,这些视图混淆了约束条件。

在InterfaceBuilder中,我有ViewController上的红色箭头错误。

执行期间,应用程序崩溃。