Crash in [NSManagedObject(ActiveRecord) isNew] : [NSNull count]: unrecognized selector sent to instance

1,240 views
Skip to first unread message

Ran Tavory

unread,
Jan 18, 2012, 1:44:47 AM1/18/12
to res...@googlegroups.com
Hi folks, had anyone seen this crash?
I got it from my crash reporter, one of my users got it, so it's nothing I can repro.

NSInvalidArgumentException-[NSNull count]: unrecognized selector sent to instance 0x3e5b95c0


0 CoreFoundation 0x30ed38bf __exceptionPreprocess 162
1 libobjc.A.dylib 0x380781e5 objc_exception_throw 32
2 CoreFoundation 0x30ed6acb -[NSObject doesNotRecognizeSelector:] 174
3 CoreFoundation 0x30ed5945 ___forwarding___ 300
4 CoreFoundation 0x30e30680 _CF_forwarding_prep_0 48
5 CoreData 0x34f5cdcf -[NSManagedObject committedValuesForKeys:] 1202
6 invi 0x000a0979 -[NSManagedObject(ActiveRecord) isNew] 24
7 invi 0x0009e48f -[RKManagedObjectLoader prepareURLRequest] 118
8 invi 0x000b2639 -[RKRequest fireAsynchronousRequest] 252
9 invi 0x000b2aeb -[RKRequest sendAsynchronously] 374
10 invi 0x000b881f -[RKRequestQueue loadNextInQueue] 914
11 CoreFoundation 0x30e3222b -[NSObject performSelector:withObject:] 42
12 Foundation 0x37f79757 __NSThreadPerformPerform 350
13 CoreFoundation 0x30ea7b03 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 14
14 CoreFoundation 0x30ea72cf __CFRunLoopDoSources0 214
15 CoreFoundation 0x30ea6075 __CFRunLoopRun 652
16 CoreFoundation 0x30e294dd CFRunLoopRunSpecific 300
17 CoreFoundation 0x30e293a5 CFRunLoopRunInMode 104
18 GraphicsServices 0x33a57fed GSEventRunModal 156
19 UIKit 0x32e9b743 UIApplicationMain 1090
20 invi 0x00003a2d main 120
21invi 0x00003478 start 40


--

Blake Watters

unread,
Jan 24, 2012, 10:43:23 PM1/24/12
to res...@googlegroups.com
Ran -

I don't know exactly how this would happen, but looking at the implementation of isNew:

- (BOOL)isNew {
    NSDictionary *vals = [self committedValuesForKeys:nil];
    return [vals count] == 0;
}

Were the vals dictionary to come back as NSNull you'd get the crash in question. I would probably recommend recreating the crash in a test by using OCMock to force an NSNull return value and then adding a NSNull check. Though I'm not sure whether or not to return YES in such a case….

--
Blake Watters
VP Engineering, GateGuru
Mobile: 919.260.3783
Get GateGuru for iOS: bit.ly/ggitunes
Get GateGuru for Android: bit.ly/ggandroid

coneybeare

unread,
Feb 9, 2012, 12:49:00 PM2/9/12
to RestKit
I have seen this crash show up in crash reports as well. I have not
yet been able to reproduce it. Ran, did you make any progress here?


On Jan 18, 1:44 am, Ran Tavory <ran...@gmail.com> wrote:
> Hi folks, had anyone seen this crash?
> I got it from my crash reporter, one of my users got it, so it's nothing I
> can repro.
>
> NSInvalidArgumentException-[NSNull count]: unrecognized selector sent to
> instance 0x3e5b95c0
>
>  0 CoreFoundation 0x30ed38bf __exceptionPreprocess 162 1 libobjc.A.dylib
> 0x380781e5 objc_exception_throw 32 2 CoreFoundation 0x30ed6acb -[NSObject
> doesNotRecognizeSelector:] 174 3 CoreFoundation 0x30ed5945 ___forwarding___
> 300 4 CoreFoundation 0x30e30680 _CF_forwarding_prep_0 48 5 CoreData
> 0x34f5cdcf -[NSManagedObject committedValuesForKeys:] 1202 6 invi
> 0x000a0979 -[NSManagedObject(ActiveRecord) isNew] 24 7 invi 0x0009e48f
> -[RKManagedObjectLoader prepareURLRequest] 118 8 invi 0x000b2639
> -[RKRequest fireAsynchronousRequest] 252 9 invi 0x000b2aeb -[RKRequest
> sendAsynchronously] 374 10 invi 0x000b881f -[RKRequestQueue
> loadNextInQueue] 914 11 CoreFoundation 0x30e3222b -[NSObject
> performSelector:withObject:] 42 12 Foundation 0x37f79757
> __NSThreadPerformPerform 350 13 CoreFoundation 0x30ea7b03
> __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 14
> 14CoreFoundation 0x30ea72cf __CFRunLoopDoSources0 214
> 15 CoreFoundation 0x30ea6075 __CFRunLoopRun 652 16 CoreFoundation
> 0x30e294dd CFRunLoopRunSpecific 300 17 CoreFoundation 0x30e293a5
> CFRunLoopRunInMode 104 18 GraphicsServices 0x33a57fed GSEventRunModal
> 156 19UIKit 0x32e9b743 UIApplicationMain 1090

Ran Tavory

unread,
Feb 9, 2012, 3:41:06 PM2/9/12
to res...@googlegroups.com
No I haven't. Been doing other things lately, on my todo list...
--

Reply all
Reply to author
Forward
0 new messages