【问题标题】:Objective C NSUnknownKeyException setValue:forUndefinedKey:目标 C NSUnknownKeyException setValue:forUndefinedKey:
【发布时间】:2014-12-10 15:06:46
【问题描述】:

在我将 xcode 升级到新版本 (6.0.1) 后,我在运行我的应用程序时遇到了 NSUnknownKeyException。

四处寻找解决方案,我发现这个问题通常出现在 xib 中的“死”出口引用,但在我的情况下,当我从 sqlite 数据库获取数据时发生。我使用 FMDB 和 BZObjectStore 库来处理我的数据库。

这是我的控制台输出:

2014-10-15 15:30:24.894 PBWines[59418:428758] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<BZObjectStoreRelationshipModel 0x79f65420> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key hash.'
*** First throw call stack:
(
    0   CoreFoundation                      0x02485df6 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x0210fa97 objc_exception_throw + 44
    2   CoreFoundation                      0x02485a11 -[NSException raise] + 17
    3   Foundation                          0x01d97d5e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x01cf3d88 _NSSetUsingKeyValueSetter + 115
    5   Foundation                          0x01cf3d0d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   PBWines                             0x00131de8 -[BZObjectStoreModelMapper select:condition:db:] + 1336
    7   PBWines                             0x00134c02 -[BZObjectStoreModelMapper relationshipObjectsWithCondition:relationshipRuntime:db:] + 162
    8   PBWines                             0x001346be -[BZObjectStoreModelMapper relationshipObjectsWithObject:attribute:relationshipRuntime:db:] + 686
    9   PBWines                             0x00146a31 -[BZObjectStoreReferenceMapper saveObjectsSub:db:error:] + 15361
    10  PBWines                             0x00142de2 -[BZObjectStoreReferenceMapper saveObjects:db:error:] + 274
    11  PBWines                             0x0014c06d -[BZObjectStoreReferenceMapper registerRuntime:db:error:] + 925
    12  PBWines                             0x0014b3d8 -[BZObjectStoreReferenceMapper runtimeWithClazz:db:error:] + 232
    13  PBWines                             0x001401a9 -[BZObjectStoreReferenceMapper fetchObjects:condition:db:error:] + 233
    14  PBWines                             0x0010cbb7 __46-[BZObjectStore fetchObjects:condition:error:]_block_invoke + 231
    15  PBWines                             0x001083c7 __40-[BZObjectStore inTransactionWithBlock:]_block_invoke + 279
    16  PBWines                             0x00194bf1 __46-[FMDatabaseQueue beginTransaction:withBlock:]_block_invoke + 273
    17  libdispatch.dylib                   0x02b6ae1f _dispatch_client_callout + 14
    18  libdispatch.dylib                   0x02b4f5bf _dispatch_barrier_sync_f_invoke + 144
    19  libdispatch.dylib                   0x02b4ecf3 dispatch_barrier_sync_f + 105
    20  libdispatch.dylib                   0x02b4f6cf dispatch_barrier_sync + 54
    21  PBWines                             0x00194a85 -[FMDatabaseQueue beginTransaction:withBlock:] + 197
    22  PBWines                             0x00194e8c -[FMDatabaseQueue inTransaction:] + 108
    23  PBWines                             0x001081ce -[BZObjectStore inTransactionWithBlock:] + 382
    24  PBWines                             0x0010c92a -[BZObjectStore fetchObjects:condition:error:] + 410
    25  PBWines                             0x000a2d7e -[PBWPaesiViewController viewDidLoad] + 702
    26  UIKit                               0x00c50d54 -[UIViewController loadViewIfRequired] + 771
    27  UIKit                               0x00c869cd -[UINavigationController _layoutViewController:] + 42
    28  UIKit                               0x00c86f3c -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
    29  UIKit                               0x00c87040 -[UINavigationController _startTransition:fromViewController:toViewController:] + 90
    30  UIKit                               0x00c87fdb -[UINavigationController _startDeferredTransitionIfNeeded:] + 669
    31  UIKit                               0x00c88c52 -[UINavigationController __viewWillLayoutSubviews] + 57
    32  UIKit                               0x00dfaebc -[UILayoutContainerView layoutSubviews] + 213
    33  UIKit                               0x00b849c0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
    34  libobjc.A.dylib                     0x02125771 -[NSObject performSelector:withObject:] + 70
    35  QuartzCore                          0x0294827f -[CALayer layoutSublayers] + 152
    36  QuartzCore                          0x0293c105 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397
    37  QuartzCore                          0x0293bf60 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    38  QuartzCore                          0x0289a676 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
    39  QuartzCore                          0x0289ba3c _ZN2CA11Transaction6commitEv + 392
    40  QuartzCore                          0x02961789 +[CATransaction flush] + 52
    41  UIKit                               0x00af77e6 -[UIApplication _reportMainSceneUpdateFinished:] + 39
    42  UIKit                               0x00af8761 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3163
    43  UIKit                               0x00b10d30 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
    44  UIKit                               0x00af6d7f -[UIApplication workspaceDidEndTransaction:] + 155
    45  FrontBoardServices                  0x04ca59de __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    46  FrontBoardServices                  0x04ca546f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    47  FrontBoardServices                  0x04cb7425 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
    48  CoreFoundation                      0x023a97a0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    49  CoreFoundation                      0x0239f0b3 __CFRunLoopDoBlocks + 195
    50  CoreFoundation                      0x0239ef0b __CFRunLoopRun + 2715
    51  CoreFoundation                      0x0239e1ab CFRunLoopRunSpecific + 443
    52  CoreFoundation                      0x0239dfdb CFRunLoopRunInMode + 123
    53  UIKit                               0x00af6744 -[UIApplication _run] + 571
    54  UIKit                               0x00af9e16 UIApplicationMain + 1526
    55  PBWines                             0x000bb7ed main + 141
    56  libdyld.dylib                       0x02b96ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

提前感谢您的帮助。

【问题讨论】:

  • 感谢您的崩溃日志。但是代码在哪里?
  • 您是否有名为hash 或类似名称的列?
  • @Kampai 我没有粘贴代码,因为崩溃不在我的代码中,而是在库中。
  • @Tommy 是的,有一个“哈希”列。我会对此进行调查
  • 已解决。这是 bzobjectstore 库中的一个错误

标签: ios objective-c sqlite ipad ios8


【解决方案1】:

我已经发布了 BZObjectStore 1.3.13。

您可以运行“pod update”并重试吗?

谢谢

【讨论】:

    猜你喜欢
    • 2015-09-16
    • 2012-06-05
    • 2014-07-03
    • 2010-09-07
    • 2012-06-22
    • 1970-01-01
    • 1970-01-01
    • 2012-04-14
    • 2017-02-19
    相关资源
    最近更新 更多