I'm developing an application that uses multiple threads to do some intensive calculations as well as fetch a good size of data. Thus, I'm trying to be a good little developer and adhere to Apple's concurrency guidelines when designing my application with CoreData. Basically, I have an NSOperation that runs and fetches the data. It returns (to a method in the main thread) an NSMutableSet that contains an NSManagedObjectID for each of the entities returned.
Here is the method in the main thread where I want to convert those NSManagedObjectIDs to actual NSManagedObject subclasses again:
-(void)updateLocalContextWithObjectIDs:(NSMutableSet *)idSet {
NSMutableSet *entitySet = [[NSMutableSet alloc] init];
for (NSManagedObjectID *objectID in idSet) {
[entitySet addObject: (Person *)[[self.dataProvider sharedManagedObjectContext] objectWithID:objectID]];
}
self.entitySet = entitySet;
[entitySet release];
}
The problem I'm having is that I'm getting the following error when this loop runs:
-[Person persistentStore]: unrecognized selector sent to instance 0x619b270
Any ideas why this is happening? Calling persistentStore on the Person object isn't being done by me---it must be happening within CoreData and I'm not doing something correctly.
Thanks in advance.
The issue was that I was passing in a set of NSManagedObjects instead of the set of NSManagedObjectIDs like I should've been.
This is solved.
Look for where you called persistantStore in your code. Then find where you over-released that object.
If you can't find where you are over releasing the object, run Instruments with NSZombies ON
Explanition:
Even though your code is not calling persistantStore on a Person, your computer is. Objective-C is a dynamic language, you're computer has a pointer to a Person object and it's sending persistantStore to that object. This usually happens when you over released something that you shouldn't have. The object has gone away and a new object has replaced it, however the pointer remains, so when you send a message to that pointer, it goes to the object that now occupies that place in memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With