3 Replies
      Latest reply on Dec 2, 2019 1:25 AM by eskimo
      Stif Level 1 Level 1 (0 points)

        Hello,

         

        I'm having an issue with my single view app. The build is succeeded but the excution fails. Here is the main code -- ViewController.swift --:

         

        //
        //  ViewController.swift
        //  Décodeur
        //
        //  Created by Boustani on 9/23/19.
        //  Copyright © 2019 Stif. All rights reserved.
        //
        
        import UIKit
        
        class ViewController: UIViewController {
            @IBOutlet weak var champMessageCodé: UITextField!
            
            @IBOutlet weak var libelléMessageDécodé: UILabel!
            
            override func viewDidLoad() {
                super.viewDidLoad()
                mettreÀJourMessageDécodé()
                champMessageCodé.becomeFirstResponder()
            }
            
            @IBAction func champTexteAChangé(_ sender: Any) {
                mettreÀJourMessageDécodé()
            }
            private static func décoder(message messageCodé: String) -> String {
                return String(messageCodé.reversed())
            }
            func mettreÀJourMessageDécodé() {
                let texteEntré = champMessageCodé.text ?? ""
                let messageDécodé = ViewController.décoder(message:texteEntré)
                libelléMessageDécodé.text = messageDécodé
            }
            
            
        
        }
        
        

         

        And here is my stacktrace:

        2019-09-29 22:05:36.999631+0100 Décodeur[32109:3024886] Unknown class _TtC9Décodeur14ViewController in Interface Builder file.

        2019-09-29 22:05:37.214381+0100 Décodeur[32109:3024886] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7ff368f07be0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key champMessageCodé.'

        *** First throw call stack:

        (

          0   CoreFoundation                      0x00000001093bf8db __exceptionPreprocess + 331

          1   libobjc.A.dylib                     0x00000001079d6ac5 objc_exception_throw + 48

          2   CoreFoundation                      0x00000001093bf449 -[NSException raise] + 9

          3   Foundation                          0x000000010744b3a6 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 289

          4   UIKitCore                           0x000000010bb11f8e -[UIViewController setValue:forKey:] + 87

          5   UIKitCore                           0x000000010bd9fcd9 -[UIRuntimeOutletConnection connect] + 109

          6   CoreFoundation                      0x00000001093abf21 -[NSArray makeObjectsPerformSelector:] + 305

          7   UIKitCore                           0x000000010bd9ca1f -[UINib instantiateWithOwner:options:] + 1810

          8   UIKitCore                           0x000000010bb1906b -[UIViewController _loadViewFromNibNamed:bundle:] + 382

          9   UIKitCore                           0x000000010bb199f5 -[UIViewController loadView] + 177

          10  UIKitCore                           0x000000010bb19d04 -[UIViewController loadViewIfRequired] + 172

          11  UIKitCore                           0x000000010bb1a524 -[UIViewController view] + 27

          12  UIKitCore                           0x000000010c15322b -[UIWindow addRootViewControllerViewIfPossible] + 122

          13  UIKitCore                           0x000000010c15391f -[UIWindow _setHidden:forced:] + 289

          14  UIKitCore                           0x000000010c16657e -[UIWindow makeKeyAndVisible] + 42

          15  UIKitCore                           0x000000010c11633c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555

          16  UIKitCore                           0x000000010c11b4e6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617

          17  UIKitCore                           0x000000010b95fa4e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904

          18  UIKitCore                           0x000000010b968346 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153

          19  UIKitCore                           0x000000010b95f664 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236

          20  UIKitCore                           0x000000010b95ffc0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091

          21  UIKitCore                           0x000000010b95e332 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782

          22  UIKitCore                           0x000000010b95dfe9 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433

          23  UIKitCore                           0x000000010b962d2e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576

          24  UIKitCore                           0x000000010b963988 _performActionsWithDelayForTransitionContext + 100

          25  UIKitCore                           0x000000010b962a95 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223

          26  UIKitCore                           0x000000010b967a48 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392

          27  UIKitCore                           0x000000010c119dc8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514

          28  UIKitCore                           0x000000010bcd102f -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361

          29  FrontBoardServices                  0x00000001145fcd25 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448

          30  FrontBoardServices                  0x0000000114606ad6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283

          31  FrontBoardServices                  0x0000000114606300 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53

          32  libdispatch.dylib                   0x000000010a757db5 _dispatch_client_callout + 8

          33  libdispatch.dylib                   0x000000010a75b2ba _dispatch_block_invoke_direct + 300

          34  FrontBoardServices                  0x00000001146380da __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30

          35  FrontBoardServices                  0x0000000114637d92 -[FBSSerialQueue _performNext] + 451

          36  FrontBoardServices                  0x0000000114638327 -[FBSSerialQueue _performNextFromRunLoopSource] + 42

          37  CoreFoundation                      0x0000000109326db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17

          38  CoreFoundation                      0x0000000109326633 __CFRunLoopDoSources0 + 243

          39  CoreFoundation                      0x0000000109320cef __CFRunLoopRun + 1231

          40  CoreFoundation                      0x00000001093204d2 CFRunLoopRunSpecific + 626

          41  GraphicsServices                    0x00000001115582fe GSEventRunModal + 65

          42  UIKitCore                           0x000000010c11cfc2 UIApplicationMain + 140

          43  DeÃÅcodeur                          0x00000001070f58eb main + 75

          44  libdyld.dylib                       0x000000010a7cc541 start + 1

          45  ???                                 0x0000000000000001 0x0 + 1

        )

        libc++abi.dylib: terminating with uncaught exception of type NSException

        (lldb)

        • Re: Thread 1: signal SIGABRT
          eskimo Apple Staff Apple Staff (12,425 points)

          Take a close read of the error message here:

          UIViewController … is not key value coding-compliant for the key champMessageCodé

          Note that it says UIViewController, not ViewController.  For some reason, the nib doesn’t know about your ViewController subclass.  You should be able to fix that in the Identity inspector.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          • Re: Thread 1: signal SIGABRT
            orion-nz Level 1 Level 1 (0 points)

            I have this same problem, but for me it only occurs when I run on an iOS 12 phone, compiling using XCode 11.2

            If I run on an iOS 13 phone it's all good.

            On iOS12 I get:

            2019-12-02 14:31:41.680401+1300 CCP.iOS[608:60415] Unknown class _TtC7CCP_iOS29BluetoothActionViewController in Interface Builder file.

            2019-12-02 14:31:41.696401+1300 CCP.iOS[608:60415] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x1021777d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _actionView.'

             

            Note: My ViewController is called BluetoothActionViewController, and it has an outlet

             

            @IBOutlet weak var _actionView: UIView!

             

            I don't think my storyboard is wrong because it does compile and run correctly all on an iOS 13 phone.
            Is there some workaround to enable this to work on iOS 12? I hope so

              • Re: Thread 1: signal SIGABRT
                eskimo Apple Staff Apple Staff (12,425 points)

                The first message you get:

                2019-12-02 14:31:41.680401+1300 CCP.iOS[608:60415] Unknown class _TtC7CCP_iOS29BluetoothActionViewController in Interface Builder file.

                confirms that the IB file is referencing your BluetoothActionViewController class, but somehow that class isn’t being found at runtime.  I suspect that the runtime is falling back to using an instance of the parent class, UIViewController, which explains the second message.

                As to why it’s not finding BluetoothActionViewController on iOS 12, I can’t think of any obvious reason for that.  If I demangle the name:

                $ swift demangle _TtC7CCP_iOS29BluetoothActionViewController
                _TtC7CCP_iOS29BluetoothActionViewController ---> CCP_iOS.BluetoothActionViewController

                I see that the class is meant to be in the CCP_iOS module.  Is that the name of your app?  Or a framework within your app?

                Oh, and exactly what build of iOS 12 are you testing this on?  iOS 12.0?  Or iOS 12.4.x?  This matters because iOS 12.2 has an embedded Swift runtime.

                Share and Enjoy

                Quinn “The Eskimo!”
                Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                let myEmail = "eskimo" + "1" + "@apple.com"