marcoarment / FCModel

An alternative to Core Data for people who like having direct SQL access.
MIT License
1.65k stars 173 forks source link

[NSDate doubleValue] - Unrecognized selector sent to instance #68

Closed papauschek closed 10 years ago

papauschek commented 10 years ago

I'm currently investigating an exception that's difficult to reproduce, possibly related to concurrent usage of FCModel (version 4c00223e3f)

The exception is [NSDate doubleValue] "Unrecognized selector sent to instance", and it happens in line 241 in FCModel.m:

    } else if (propertyClass == NSDate.class) {
        return [NSDate dateWithTimeIntervalSince1970:[databaseValue doubleValue]];

So, apparently, the databaseValue is already an instance of NSDate, how can this happen?

Possibly this has to do with unsaved changes from another thread, as I'm also getting the occasional SIGSEGV in [FCModel reload]:

__18-[FCModel reload:]_block_invoke in FCModel.m on Line 649
__35-[FCModelDatabaseQueue inDatabase:]_block_invoke in FCModelDatabaseQueue.m on Line 79
-[FCModelDatabaseQueueOperation main] in FCModelDatabaseQueue.m on Line 17

Any help would be greatly appreciated. (And thanks for this great library!)

marcoarment commented 10 years ago

In the absence of more information or similar reports from anyone else, I'm closing this for now — please let me know if you've been able to reproduce it since then. Thanks.

johncblandii commented 10 years ago

I have seen this as well. It happens randomly in our app but I cannot tell you if it was on the latest pods release or not; although, I'm pretty sure it was.

papauschek commented 10 years ago

It happens randomly from time to time, also in fcmodel-0.9.0 (only the line number changed)

Here is another stacktrace for future reference.

-[__NSDate doubleValue]: unrecognized selector sent to instance 0x18e2e540
fcmodel-[FCModel unserializedRepresentationOfDatabaseValue:forPropertyNamed:] 
in FCModel.m on Line 252

0   CoreFoundation  0x30d30fd3  __exceptionPreprocess
1   libobjc.A.dylib 0x3b4ddccf  objc_exception_throw
2   CoreFoundation  0x30d34967  -[NSObject(NSObject) doesNotRecognizeSelector:]
3   CoreFoundation  0x30d33253  ___forwarding___
4   CoreFoundation  0x30c827f8  _CF_forwarding_prep_0
5   fcmodel 0x0014a3f5  -[FCModel unserializedRepresentationOfDatabaseValue:forPropertyNamed:] in FCModel.m on Line 252
6   fcmodel 0x0014a5b7  -[FCModel decodeFieldValue:intoPropertyName:] in FCModel.m on Line 269
7   fcmodel 0x0014d837  __18-[FCModel reload:]_block_invoke365 in FCModel.m on Line 720
8   CoreFoundation  0x30cbff5b  __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke
9   CoreFoundation  0x30cb3233  -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]
10  fcmodel 0x0014d42d  -[FCModel reload:] in FCModel.m on Line 722
11  CoreFoundation  0x30cf31f1  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
12  CoreFoundation  0x30c6757f  _CFXNotificationPost
13  Foundation  0x31651a3d  -[NSNotificationCenter postNotificationName:object:userInfo:]
14  fcmodel 0x00149e9b  +[FCModel dataWasUpdatedExternally] in FCModel.m on Line 209
15  fcmodel 0x0014ab3d  +[FCModel executeUpdateQuery:] in FCModel.m on Line 330
marcoarment commented 10 years ago

Try with this new build.

papauschek commented 10 years ago

Thanks for the fixes.

As I'm trying to keep dependencies of my project sane, I don't want to depend on specific git commits anymore in production. It would be great if you could push out a new cocoapods version, then I can test the release and possibly put it into production.

marcoarment commented 10 years ago

I will, but not yet — I prefer to let changes sit and stabilize for a week or two before updating the "official" version.