gpt4 book ai didi

ios - 导致错误线程 1 :Signal Sigabrt 的 IB 导出和操作

转载 作者:行者123 更新时间:2023-11-28 06:06:38 26 4
gpt4 key购买 nike

我目前正在通过 Xcode 为 iPhone 创建一个健身应用程序。它具有三个不同的 View Controller 和一个附加到每个 View Controller 的文件。我目前正在使用第二个文件的第二个 View Controller 中工作,目前我刚刚在代码中添加了四个 IB 导出,并为一个按钮添加了一个 IB 操作。然而,当我运行代码时,它在模拟器中卡住并带我回到带有 AppDelegate 类的屏幕,并且它有一个红色区域,上面写着 Signal Sigabrt。当我删除所有 socket 和 Action 时,程序运行良好并且一切正常,但是当我添加一个 socket 时,模拟器再次卡住并且 Signal Sigabrt 再次返回。我在许多其他帖子中在线阅读,这是因为元素与导出和 Action 之间的连接问题,所以我通过连接检查器删除了 Action 和导出,然后重新连接了所有东西。但是,这并没有解决任何问题,我仍然遇到同样的 Signal Sigabrt 问题。我查看了调试器给我的内容,它说 Breakfast1 导出是错误的,所以我通过连接检查器删除了那个导出并再次运行程序,但它一直告诉我下一个导出是错误的,它再次给我 Signal Sigabrt。有没有其他人遇到过这个问题,可以帮我解决?

我的 ViewController2 代码:

import UIKit
class ViewController2: UIViewController {
@IBOutlet weak var Breakfast1: UITextField!
@IBOutlet weak var Lunch1: UITextField!
@IBOutlet weak var Dinner1: UITextField!
@IBOutlet weak var Total1: UILabel!


override func viewDidLoad() {
super.viewDidLoad()
/
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
/
}

@IBAction func addingButton(_ sender: Any) {
}

}

调试区给我的是什么:

2017-12-28 14:06:03.645843-0700 Fitness App FBLA[96716:47605553] Unknown class ViewController2 in Interface Builder file.
2017-12-28 14:06:03.658340-0700 Fitness App FBLA[96716:47605553] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-12-28 14:06:03.659452-0700 Fitness App FBLA[96716:47605553] [MC] Loaded MobileCoreServices.framework
2017-12-28 14:06:03.692388-0700 Fitness App FBLA[96716:47605553] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/basketballboy03/Library/Developer/CoreSimulator/Devices/8342977F-88AA-474E-BDEB-EAABE8007D1C/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-12-28 14:06:03.749797-0700 Fitness App FBLA[96716:47605553] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fa6e3417c40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Breakfast1.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cd4b1ab __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001090f3f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010cd4b0f9 -[NSException raise] + 9
3 Foundation 0x0000000108b161e3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x0000000109b2d777 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x0000000109e1ccb1 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010ccee4fd -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x0000000109e1b667 -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x0000000109b34838 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x0000000109b35164 -[UIViewController loadView] + 177
10 UIKit 0x0000000109b35495 -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x0000000109b35cf2 -[UIViewController view] + 27
12 UIKit 0x000000010a5c53a9 -[_UIFullscreenPresentationController _setPresentedViewController:] + 89
13 UIKit 0x0000000109b03ba7 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
14 UIKit 0x0000000109b48f6a -[UIViewController _presentViewController:withAnimationController:completion:] + 3808
15 UIKit 0x0000000109b4bdad __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
16 UIKit 0x0000000109b4c47d -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
17 UIKit 0x0000000109b4bd0c -[UIViewController _presentViewController:animated:completion:] + 181
18 UIKit 0x0000000109b4c06b -[UIViewController presentViewController:animated:completion:] + 159
19 UIKit 0x000000010a297cbc __74-[UIStoryboardPresentationSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 133
20 UIKit 0x000000010a2b7dcb -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 279
21 UIKit 0x000000010a2b7c83 -[UIStoryboardSegueTemplate _perform:] + 82
22 UIKit 0x000000010a2b7f4b -[UIStoryboardSegueTemplate perform:] + 157
23 UIKit 0x0000000109992275 -[UIApplication sendAction:to:from:forEvent:] + 83
24 UIKit 0x0000000109b0f4a2 -[UIControl sendAction:to:forEvent:] + 67
25 UIKit 0x0000000109b0f7bf -[UIControl _sendActionsForEvents:withEvent:] + 450
26 UIKit 0x0000000109b0e6ec -[UIControl touchesEnded:withEvent:] + 618
27 UIKit 0x0000000109a07bbb -[UIWindow _sendTouchesForEvent:] + 2807
28 UIKit 0x0000000109a092de -[UIWindow sendEvent:] + 4124
29 UIKit 0x00000001099ace36 -[UIApplication sendEvent:] + 352
30 UIKit 0x000000010a2ef434 __dispatchPreprocessedEventFromEventQueue + 2809
31 UIKit 0x000000010a2f2089 __handleEventQueueInternal + 5957
32 CoreFoundation 0x000000010ccee231 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
33 CoreFoundation 0x000000010cd8de41 __CFRunLoopDoSource0 + 81
34 CoreFoundation 0x000000010ccd2b49 __CFRunLoopDoSources0 + 185
35 CoreFoundation 0x000000010ccd212f __CFRunLoopRun + 1279
36 CoreFoundation 0x000000010ccd19b9 CFRunLoopRunSpecific + 409
37 GraphicsServices 0x000000010f4b39c6 GSEventRunModal + 62
38 UIKit 0x00000001099905e8 UIApplicationMain + 159
39 Fitness App FBLA 0x00000001087dcbf7 main + 55
40 libdyld.dylib 0x000000010de77d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

最佳答案

看起来您没有在 Interface Builder 中为 View Controller 设置正确的类。

选择 View Controller 后,在 Identity Inspector 的 Interface Builder 右侧将类设置为 ViewController2。

enter image description here

关于ios - 导致错误线程 1 :Signal Sigabrt 的 IB 导出和操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48014899/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com