xcode iOS 重命名视图控制器后应用程序崩溃
xcode iOS App Crashes after the renaming of view controller
Outlets Crash at Entry 崩溃图片截图
重命名 View Controller 后出现崩溃。 Swift 文件到 CalculatorViewController.swift
我还尝试重构新的 class 名称以在应用程序的所有入口端口进行镜像。我收到中止信号错误。请帮忙解决这个问题!这是我的错误
更新:队列中的错误 com.apple.mainthread(串行)线程 1
代码中的崩溃点
class AppDelegate: UIResponder, UIApplicationDelegate {
更新。
2019-03-11 15:36:01.990755+0530 NDv2[4619:144763] Unknown class
CalculatorViewController in Interface Builder file. 2019-03-11
15:36:02.040903+0530 NDv2[4619:144763] * Terminating app due to
uncaught exception 'NSUnknownKeyException', reason:
'[ setValue:forUndefinedKey:]: this
class is not key value coding-compliant for the key TextOutput.'
* First throw call stack: ( 0 CoreFoundation 0x000000010ef3e1bb exceptionPreprocess + 331 1 libobjc.A.dylib
0x000000010cf58735 objc_exception_throw + 48 2 CoreFoundation
0x000000010ef3dd29 -[NSException raise] + 9 3 Foundation
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 instantiateWithOwner:options:] + 1814 8
UIKitCore 0x00000001113aa452
-[UIViewController _loadViewFromNibNamed:bundle:] + 383 9 UIKitCore 0x00000001113aaddc -[UIViewController loadView] + 177 10 UIKitCore
0x00000001113ab0ee -[UIViewController loadViewIfRequired] + 175 11
UIKitCore 0x00000001113ab940
-[UIViewController view] + 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 workspace:didCreateScene:withTransitionContext:completion:] + 515 28
UIKitCore 0x000000011156bd09
-[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357 29
FrontBoardServices 0x000000011a0fc2da -[FBSSceneImpl
_didCreateWithTransitionContext:completion:] + 448 30 FrontBoardServices 0x000000011a107443
__56-[FBSWorkspace client: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 main + 71 44 libdyld.dylib
0x00000001104f4575 start + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
有两种方法可以更改ViewController的名称:
1)
例如:class LoginViewController: UIViewController - just select the "LoginViewController", 然后右击 -> Refactor -> Rename
这将更改名称文件名、class 名称并处理故事板 class 名称。
2) 如果你不能使用方法一,然后手动重命名文件名称(.swift),那么你必须去故事板并替换class名称视图控制器。您可能对插座有问题。
3) 之后关闭 Xcode 然后再次启动您的项目。
故事板的控制器中有 textField 或 textView 或 UILabel,
1- 打开故事板
2- 单击 UIViewController(ViewController 新名称 class 您已更改)
3- 删除名称为 TextOutput
的插座
4- ReConnet 如果你愿意,你准备好了
您收到的错误是因为您的故事板上有一个 IBOutlet,它在定义它的 class 上不再存在,这可能是因为您手动更改了 属性 在您的 class 上或将其删除。
在您的故事板上,select 初始视图控制器并检查是否存在对名为 TextOutput 的 IBOutlet 的引用。再次删除该引用和 link 视图。这应该可以解决它
我通过在 Identity inspector
中为 'Custom class' 设置 'module' 解决了这个问题
Outlets Crash at Entry 崩溃图片截图
重命名 View Controller 后出现崩溃。 Swift 文件到 CalculatorViewController.swift 我还尝试重构新的 class 名称以在应用程序的所有入口端口进行镜像。我收到中止信号错误。请帮忙解决这个问题!这是我的错误 更新:队列中的错误 com.apple.mainthread(串行)线程 1
代码中的崩溃点
class AppDelegate: UIResponder, UIApplicationDelegate {
更新。
2019-03-11 15:36:01.990755+0530 NDv2[4619:144763] Unknown class CalculatorViewController in Interface Builder file. 2019-03-11 15:36:02.040903+0530 NDv2[4619:144763] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key TextOutput.' * First throw call stack: ( 0 CoreFoundation 0x000000010ef3e1bb exceptionPreprocess + 331 1 libobjc.A.dylib
0x000000010cf58735 objc_exception_throw + 48 2 CoreFoundation
0x000000010ef3dd29 -[NSException raise] + 9 3 Foundation
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 instantiateWithOwner:options:] + 1814 8
UIKitCore 0x00000001113aa452 -[UIViewController _loadViewFromNibNamed:bundle:] + 383 9 UIKitCore 0x00000001113aaddc -[UIViewController loadView] + 177 10 UIKitCore
0x00000001113ab0ee -[UIViewController loadViewIfRequired] + 175 11 UIKitCore 0x00000001113ab940 -[UIViewController view] + 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 workspace:didCreateScene:withTransitionContext:completion:] + 515 28 UIKitCore 0x000000011156bd09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357 29 FrontBoardServices 0x000000011a0fc2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448 30 FrontBoardServices 0x000000011a107443 __56-[FBSWorkspace client: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 main + 71 44 libdyld.dylib
0x00000001104f4575 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
1) 例如:class LoginViewController: UIViewController - just select the "LoginViewController", 然后右击 -> Refactor -> Rename
这将更改名称文件名、class 名称并处理故事板 class 名称。
2) 如果你不能使用方法一,然后手动重命名文件名称(.swift),那么你必须去故事板并替换class名称视图控制器。您可能对插座有问题。
3) 之后关闭 Xcode 然后再次启动您的项目。
故事板的控制器中有 textField 或 textView 或 UILabel,
1- 打开故事板
2- 单击 UIViewController(ViewController 新名称 class 您已更改)
3- 删除名称为 TextOutput
4- ReConnet 如果你愿意,你准备好了
您收到的错误是因为您的故事板上有一个 IBOutlet,它在定义它的 class 上不再存在,这可能是因为您手动更改了 属性 在您的 class 上或将其删除。
在您的故事板上,select 初始视图控制器并检查是否存在对名为 TextOutput 的 IBOutlet 的引用。再次删除该引用和 link 视图。这应该可以解决它
我通过在 Identity inspector
中为 'Custom class' 设置 'module' 解决了这个问题