ios - 无法设置(keyPath)此类上的用户定义的检查属性不符合键 keyPath 的键值编码

标签 ios xcode swift

我的 swift 应用程序在运行时失败。我该如何解决这个问题?

我已经检查过,avgTime_text 定义良好。

我不知道如何在 xcode 中读取堆栈跟踪,有人可以帮忙提供一些指导吗?

2016-02-06 15:16:07.298 Inline[39053:200479] Unknown class _TtC6Inline24InlineMainViewController in Interface Builder file.
2016-02-06 15:16:15.414 Inline[39053:] <GMR/INFO> App measurement v.1302000 started
2016-02-06 15:16:15.414 Inline[39053:] <GMR/INFO> To enable debug logging set the following application argument: -GMRDebugEnabled (see http://goo.gl/Y0Yjwu)
2016-02-06 15:16:15.466 Inline[39053:200479] Unknown class _TtC6Inline24InlineMainViewController in Interface Builder file.
2016-02-06 15:16:15.524 Inline[39053:200479] Unknown class logo in Interface Builder file.
2016-02-06 15:16:15.538 Inline[39053:200479] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7fa3590a47d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-06 15:16:15.538 Inline[39053:200479] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7fa3590c9c70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-06 15:16:15.538 Inline[39053:200479] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7fa35846ccf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-06 15:16:15.542 Inline[39053:200479] WARNING: GoogleAnalytics 3.14 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:48): Uncaught exception: [<UIViewController 0x7fa3590c4cd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key avgTime_text.
2016-02-06 15:16:15.672 Inline[39053:] <GMR/INFO> App measurement enabled
2016-02-06 15:16:20.548 Inline[39053:200479] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fa3590c4cd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key avgTime_text.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010ab10e65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010bfd3deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010ab10aa9 -[NSException raise] + 9
    3   Foundation                          0x000000010bba09bb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
    4   UIKit                               0x000000010cb15320 -[UIViewController setValue:forKey:] + 88
    5   UIKit                               0x000000010cd43f41 -[UIRuntimeOutletConnection connect] + 109
    6   CoreFoundation                      0x000000010aa514a0 -[NSArray makeObjectsPerformSelector:] + 224
    7   UIKit                               0x000000010cd42924 -[UINib instantiateWithOwner:options:] + 1864
    8   UIKit                               0x000000010cb1beea -[UIViewController _loadViewFromNibNamed:bundle:] + 381
    9   UIKit                               0x000000010cb1c816 -[UIViewController loadView] + 178
    10  UIKit                               0x000000010cb1cb74 -[UIViewController loadViewIfRequired] + 138
    11  UIKit                               0x000000010cb1d2e7 -[UIViewController view] + 27
    12  UIKit                               0x000000010c9f3ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
    13  UIKit                               0x000000010c9f4199 -[UIWindow _setHidden:forced:] + 282
    14  UIKit                               0x000000010ca05c2e -[UIWindow makeKeyAndVisible] + 42
    15  Inline                              0x00000001097984f7 _TFC6Inline11AppDelegate16launchStoryboardfS0_FOS_10StoryboardT_ + 1127
    16  Inline                              0x0000000109798048 _TFC6Inline11AppDelegate25chooseAndLuanchStoryboardfS0_FT_T_ + 248
    17  Inline                              0x00000001097985a9 _TFC6Inline11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 105
    18  Inline                              0x00000001097986e3 _TToFC6Inline11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 179
    19  UIKit                               0x000000010c97d1f1 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
    20  UIKit                               0x000000010c97e397 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
    21  UIKit                               0x000000010c984cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
    22  UIKit                               0x000000010c981e7b -[UIApplication workspaceDidEndTransaction:] + 188
    23  FrontBoardServices                  0x000000011019d754 -[FBSSerialQueue _performNext] + 192
    24  FrontBoardServices                  0x000000011019dac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    25  CoreFoundation                      0x000000010aa3ca31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    26  CoreFoundation                      0x000000010aa3295c __CFRunLoopDoSources0 + 556
    27  CoreFoundation                      0x000000010aa31e13 __CFRunLoopRun + 867
    28  CoreFoundation                      0x000000010aa31828 CFRunLoopRunSpecific + 488
    29  UIKit                               0x000000010c9817cd -[UIApplication _run] + 402
    30  UIKit                               0x000000010c986610 UIApplicationMain + 171
    31  Inline                              0x00000001097998dd main + 109
    32  libdyld.dylib                       0x000000010e5b792d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

这里是代码失败的地方:AppDeligate下的window?.makeKeyAndVisible()

func launchStoryboard(storyboard: Storyboard) {
    window = UIWindow(frame: UIScreen.mainScreen().bounds)
    UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Slide)
    let storyboard = UIStoryboard(name: storyboard.rawValue, bundle: nil)
    let controller = storyboard.instantiateInitialViewController()!
    if (controller is InlineMainViewController ){
        mainViewController = controller as! InlineMainViewController
    }
    window?.rootViewController = controller
    window?.makeKeyAndVisible()
}

最佳答案

尽管这是一篇旧文章,但请在 Xcode 中检查用户定义的运行时属性。您可能已经在那里声明了默认属性,删除它应该可以解决您的问题。

关于ios - 无法设置(keyPath)此类上的用户定义的检查属性不符合键 keyPath 的键值编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35241514/

相关文章:

iphone - 如何从 UISlider 获取 RGB 颜色值

ios - 只允许 UIScrollView 缩放弹跳时放大,不缩小

ios - 使用 CocoaPods 添加的库链接错误

iphone - 从 Content-Disposition header 获取文件名

ios - iOS8 中 iPhone 应用程序启动图像的大小和命名

ios - 如何使用oauth发送https GET请求

swift - 如何使用泛型为结构定义不同的名称

iOS:如何使用自定义信息窗口动态创建 GMSMarker?

iphone - Xcode:一步构建并运行 iOS 模拟器和设备?

swift + Xcode : use osascript in Mac App