gpt4 book ai didi

ios - NSException 类型的未捕获异常(连接似乎很好) - Wenderlich 教程

转载 作者:行者123 更新时间:2023-11-30 14:19:27 25 4
gpt4 key购买 nike

我是一名初学者,正在学习 Ray Wenderlich 的 Swift 教程,第 2 部分。

本课的最终代码(我收到错误)在这里:http://cdn5.raywenderlich.com/wp-content/uploads/2014/06/TipCalculator-Demo4.zip

当我通过 Xcode 6.3.2 构建应用程序并在 iOS 模拟器 (iPhone 6) 上运行它时,我收到以下错误消息(对于格式不佳表示抱歉)。

我在 Google 和 StackOverflow 上进行了搜索,似乎人们经常遇到类似的错误,但可以通过转到 View Controller 、检查连接检查器并修复任何标记的连接来修复它(例如,所连接的对象不再存在)。

注意:我的连接检查器中没有任何标志 - 一切看起来都很好,包括 Storyboard 中 resultsTextView 和 Text View 对象之间的连接(请参阅附图)

请告诉我如何解决这个问题 - 谢谢。

---------请参阅最右侧的连接检查器 - 看起来不错!---------

http://i.imgur.com/X6eA05F.png

---------错误信息---------

2015-06-05 17:07:39.866 TipCalculator[4848:128801] * 由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[ setValue:forUndefinedKey:]:此类不是键值编码- 符合关键结果TextView。'*第一次抛出调用堆栈:

(
0 CoreFoundation 0x0000000100216c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000101d81bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001002168a9 -[NSException raise] + 9
3 Foundation 0x0000000100634b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010015ed50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x0000000100d8d52b -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x0000000100be5718 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x0000000100be5d08 -[UIViewController loadView] + 109
8 UIKit 0x0000000100be5f79 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x0000000100c1601b -[UINavigationController _layoutViewController:] + 44
10 UIKit 0x0000000100c16565 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 216
11 UIKit 0x0000000100c16664 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
12 UIKit 0x0000000100c17448 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
13 UIKit 0x0000000100c17f0e -[UINavigationController __viewWillLayoutSubviews] + 43
14 UIKit 0x0000000100d62715 -[UILayoutContainerView layoutSubviews] + 202
15 UIKit 0x0000000100b35a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
16 QuartzCore 0x0000000104916ec2 -[CALayer layoutSublayers] + 146
17 QuartzCore 0x000000010490b6d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
18 QuartzCore 0x000000010490b546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
19 QuartzCore 0x0000000104877886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
20 QuartzCore 0x0000000104878a3a _ZN2CA11Transaction6commitEv + 462
21 UIKit 0x0000000100ab3a2d -[UIApplication _reportMainSceneUpdateFinished:] + 44
22 UIKit 0x0000000100ab46f1 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2648
23 UIKit 0x0000000100ab30d5 -[UIApplication workspaceDidEndTransaction:] + 179
24 FrontBoardServices 0x00000001038915e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
25 CoreFoundation 0x000000010014a41c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
26 CoreFoundation 0x0000000100140165 __CFRunLoopDoBlocks + 341
27 CoreFoundation 0x000000010013f947 __CFRunLoopRun + 887
28 CoreFoundation 0x000000010013f366 CFRunLoopRunSpecific + 470
29 UIKit 0x0000000100ab2b42 -[UIApplication _run] + 413
30 UIKit 0x0000000100ab5900 UIApplicationMain + 1282
31 TipCalculator 0x000000010002c177 main + 135
32 libdyld.dylib 0x00000001024d9145 start + 1
33 ??? 0x0000000000000001 0x0 + 1
)

libc++abi.dylib:以 NSException 类型的未捕获异常终止(lldb)

最佳答案

确保正确执行这些步骤:

Open Main.storyboard and select your View Controller in the Document Outline. Open the Connections Inspector (6th tab), and you will see all of the properties you created listed in the Outlets section. 021_ConnectionsInspector You’ll notice a small circle to the right of resultsTextView. Control-drag from that button down to the text view below the Calculate button, and release to connect your Swift property to this view.

我相信您缺少在此步骤中创建的@IBOutlet

关于ios - NSException 类型的未捕获异常(连接似乎很好) - Wenderlich 教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30677612/

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