重命名视图控制器后,xcode iOS App崩溃

时间:2019-03-11 10:21:22

标签: ios swift xcode swift3

Outlets Crash at Entry崩溃图像截图

Crash Image Screenshot[1]

重命名View Controller之后,我崩溃了。 Swift文件到CalculatorViewController.swift 我还尝试了重构新的类名,以在应用程序的所有进入端口之间进行镜像。我收到中止信号错误。请为此提供帮助!这是我的错误 更新:队列com.apple.mainthread(串行)线程1中出错

代码崩溃点

  

AppDelegate类:UIResponder,UIApplicationDelegate {

更新。

  

2019-03-11 15:36:01.990755 + 0530 NDv2 [4619:144763]未知类   接口生成器文件中的CalculatorViewController。 2019-03-11   15:36:02.040903 + 0530 NDv2 [4619:144763] *由于以下原因终止了应用   未捕获的异常“ NSUnknownKeyException”,原因:   '[setValue:forUndefinedKey:]:此   类别与键TextOutput的键值编码不兼容。   * 第一个调用堆栈:(0 CoreFoundation 0x000000010ef3e1bb exceptionPreprocess + 331 1 libobjc.A.dylib
  0x000000010cf58735 objc_exception_throw + 48 2 CoreFoundation
  0x000000010ef3dd29-[NSException提高] + 9 3基金会
  0x000000010c983de4-[NSObject(NSKeyValueCoding)setValue:forKey:] +   292 4 UIKitCore 0x00000001113a3292   -[UIViewController setValue:forKey:] + 87 5 UIKitCore 0x000000011163a573-[UIRuntimeOutletConnection connect] + 109 6
  CoreFoundation 0x000000010ef29cfd-[NSArray   makeObjectsPerformSelector:] + 317 7 UIKitCore
  0x00000001116372b9-[UINib实例化拥有者:选项:] + 1814 8
  UIKitCore 0x00000001113aa452   -[UIViewController _loadViewFromNibNamed:bundle:] + 383 9 UIKitCore 0x00000001113aaddc-[UIViewController loadView] + 177 10 UIKitCore
  0x00000001113ab0ee-[UIViewController loadViewIfRequired] + 175 11   UIKitCore 0x00000001113ab940   -[UIViewController视图] + 27 12 UIKitCore 0x0000000111a02c53-[UIWindow addRootViewControllerViewIfPossible] +   122 13 UIKitCore 0x0000000111a0336e   -[UIWindow _setHidden:forced:] + 294 14 UIKitCore 0x0000000111a165c0-[UIWindow makeKeyAndVisible] + 42 15 UIKitCore
  0x00000001119c3833-[UIApplication   _callInitializationDelegatesForMainScene:transitionContext:] + 4595 16 UIKitCore 0x00000001119c8c2f   -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623 17 UIKitCore 0x00000001111e74e9   __111-[__ UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] _ block_invoke   + 866 18 UIKitCore 0x00000001111f029c + [_ UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 19 UIKitCore 0x00000001111e7126   -[__ UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233 20 UIKitCore 0x00000001111e7ae0   -[__ UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085 21 UIKitCore
  0x00000001111e5cb5 __82-[_ UIApplicationCanvas   _transitionLifecycleStateWithTransitionContext:completion:] _ block_invoke   + 795 22 UIKitCore 0x00000001111e595f-[_ UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435 23 UIKitCore 0x00000001111eaa90   __125-[_ UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] _ block_invoke   + 584 24 UIKitCore 0x00000001111eb80e _performActionsWithDelayForTransitionContext + 100 25 UIKitCore 0x00000001111ea7ef-[_ UICanvasLifecycleSettingsDiffAction   performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]   + 221 26 UIKitCore 0x00000001111ef93a-[_ UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 27 UIKitCore 0x00000001119c744e   -[UIApplication工作区:didCreateScene:withTransitionContext:完成:] + 515 28   UIKitCore 0x000000011156bd09   -[UIApplicationSceneClientAgent场景:didInitializeWithEvent:完成:] + 357 29   FrontBoardServices 0x000000011a0fc2da-[FBSSceneImpl   _didCreateWithTransitionContext:completion:] + 448 30 FrontBoardServices 0x000000011a107443   __56- [FBSWorkspace客户端:handleCreateScene:withCompletion:] _ block_invoke_2 + 271 31   FrontBoardServices 0x000000011a106b3a   __40- [FBSWorkspace _performDelegateCallOut:] _ block_invoke + 53 32 libdispatch.dylib 0x000000011047e602   _dispatch_client_callout + 8 33 libdispatch.dylib 0x0000000110481b78 _dispatch_block_invoke_direct + 301 34   FrontBoardServices 0x000000011a13bba8   __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
+ 30 35 FrontBoardServices 0x000000011a13b860   -[FBSSerialQueue _performNext] + 457 36 FrontBoardServices 0x000000011a13be40-[FBSSerialQueue _performNextFromRunLoopSource] +   45 37 CoreFoundation 0x000000010eea3721    CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 38 CoreFoundation 0x000000010eea2f93   __CFRunLoopDoSources0 + 243 39 CoreFoundation 0x000000010ee9d63f __CFRunLoopRun + 1263 40 CoreFoundation
  0x000000010ee9ce11 CFRunLoopRunSpecific + 625 41 GraphicsServices
  0x000000011713b1dd GSEventRunModal + 62 42 UIKitCore
  0x00000001119ca81d UIApplicationMain + 140 43 NDv2
  0x000000010c6291c7主+ 71 44 libdyld.dylib
  0x00000001104f4575 start + 1)libc ++ abi.dylib:终止于   类型为NSException的未捕获异常

3 个答案:

答案 0 :(得分:1)

enter image description here有两种更改ViewController名称的方法:

1) 例如:类LoginViewController:UIViewController-只需选择“ LoginViewController”,然后右键单击->重构->重命名

这将更改名称文件名,类名,并照顾情节提要的类名。

2)如果无法使用方法1,则手动重命名文件Name(.swift),则必须转到情节提要,并替换视图控制器的类名。您可能对网点有疑问。

3)之后,关闭Xcode,然后再次启动您的项目。

答案 1 :(得分:0)

您在情节提要中的控制器中有一个textField或textView或UILabel,

1-打开情节提要

2-单击UIViewController(具有已更改的类的新名称的ViewController)

3-移除名称为TextOutput的插座

4- ReConnet(如果需要),并且准备好了

答案 2 :(得分:0)

我通过在身份检查器中为“自定义类”设置“模块”来解决了该问题

相关问题