Restkit / CoreData __NSCFBoolean长度无法识别的选择器发送到实例

时间:2014-12-07 13:00:21

标签: ios objective-c core-data restkit

我正在尝试调试此崩溃。它似乎在Apple的描述方法框架内,但我不知道它导致了什么。

我正在使用Restkit和Core Data。一旦API返回新模型,我就会崩溃#34;类别"与阵列"产品"空。

谢谢

RRCategory + RRProduct模型 https://gist.github.com/imton/6f7ff91bc3f3ac25a490

映射 https://gist.github.com/imton/33236e0ddefef0d50a35 https://gist.github.com/imton/9baa6a35a4a8f71aa440

Api Json https://gist.github.com/imton/118736e59c1a1092dc1b

{
"categories": [
    {
    "token": "6G1RKVMcfNdcbAX",
    "title": "Cat3",
    "picture_token": "ASDFASDF",
    "products": []
    }
]
}

返回堆栈

2014-12-07 10:55:30.838 Riderr[91164:34420246] -[__NSCFBoolean length]: unrecognized selector sent to instance 0x10375c970
2014-12-07 10:55:30.862 Riderr[91164:34420246] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean length]: unrecognized selector sent to instance 0x10375c970'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001034b1b75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010314abb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001034b8c8d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00000001034106fc ___forwarding___ + 988
    4   CoreFoundation                      0x0000000103410298 _CF_forwarding_prep_0 + 120
    5   CoreData                            0x0000000100d3135c -[NSManagedObject _descriptionValues] + 620
    6   CoreData                            0x0000000100d3195b -[NSManagedObject description] + 267
    7   Riderr                              0x000000010037393b -[NSManagedObject(FixCrashBug) description_swizzle] + 43
    8   CoreFoundation                      0x00000001034a3ea6 -[NSArray descriptionWithLocale:indent:] + 358
    9   Foundation                          0x00000001014f3524 _NSDescriptionWithLocaleFunc + 64
    10  CoreFoundation                      0x00000001033ac97d __CFStringAppendFormatCore + 9645
    11  CoreFoundation                      0x00000001034922f0 _CFStringCreateWithFormatAndArgumentsAux2 + 256
    12  Foundation                          0x00000001014f34b8 -[NSPlaceholderString initWithFormat:locale:arguments:] + 153
    13  Riderr                              0x00000001003ad29c +[DDLog log:level:flag:context:file:function:line:tag:format:] + 588
    14  Riderr                              0x0000000100373b6d __21-[RRHomeTableVC sync]_block_invoke + 205
    15  Riderr                              0x00000001003770be __72-[RRRiderrClient getAllCategoriesWithProductsSuccessBlock:failureBlock:]_block_invoke + 142
    16  Riderr                              0x000000010051b92b __66-[RKObjectRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke244 + 91
    17  libdispatch.dylib                   0x00000001041b4b06 _dispatch_call_block_and_release + 12
    18  libdispatch.dylib                   0x00000001041d2794 _dispatch_client_callout + 8
    19  libdispatch.dylib                   0x00000001041bb89b _dispatch_main_queue_callback_4CF + 949
    20  CoreFoundation                      0x0000000103419469 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    21  CoreFoundation                      0x00000001033dc36b __CFRunLoopRun + 2043
    22  CoreFoundation                      0x00000001033db906 CFRunLoopRunSpecific + 470
    23  GraphicsServices                    0x00000001076de9f0 GSEventRunModal + 161
    24  UIKit                               0x0000000101e901a0 UIApplicationMain + 1282
    25  Riderr                              0x0000000100370fbc main + 140
    26  libdyld.dylib                       0x0000000104207145 start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)

1 个答案:

答案 0 :(得分:0)

这意味着当你需要一个字符串时,你给CoreData提供一个NSNumber包装的布尔值。

然后显然你使用方法调配这是一个非常糟糕的主意,并可能导致此类崩溃。