AFIncrementalStore Unrecognized selector -[NSNull length] error

249 Views Asked by At

I'm trying to add AFIncrementalStore to an existing Core Data app with lots of data already in the database. I thought I'd added everything necessary, then I fire up the app, and during the initial fetch requests I get this error:

-[NSNull length]: unrecognised selector sent to instance 0xNNNNNNN

The error itself is fired on the AFReferenceObjectFromResourceIdentifier method here.

The source of the error appears to creep in in AFIncrementStore.m in the executeFetchRequest:withContext:error: method - when it calls [results valueForKeyPath:kAFIncrementalStoreResourceIdentifierAttributeName] - the returned array contains one or more NSNull values. (find it on GitHub here)

The whole library appears to have very little documentation, so I'm sure it's something really 'obvious' that I'm supposed to have done to my code / data model.

1

There are 1 best solutions below

1
On

Try doing "Reset Content & Settings" on your iOS simulator. I know this sounds crazy, but I was getting this exact same, inexplicable bug myself (ended up ruining a couple live demo before figuring this out).

"Turn it off and on again" is not the most satisfying solution, but at least it's something.