0
votes

I currently try to implement the RestKit CoreData extension to cache objects to my device. The problem is that I can apparently not exclude certain objects that are linked in code.

I'll give an example:

My object Message:

@interface Message : NSManagedObject

@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *text;
@property (nonatomic, copy) User *user;

@end

I want Message to be cached, but the User object shall just be in that object when the data comes from the server.

However I get this error:

[<NSManagedObject 0xeaa1290> valueForUndefinedKey:]: the entity Message is not key value coding-compliant for the key "user".'

Is there any way to go around this problem?

1
What data do you get from the server? This error is during mapping? What is your mapping? Is User a managed object? Do you need the user to be mapped out of the response from the server or you don't really need it. - Wain
Ok one by one :) Just to clarify. 1. Data is JSON 2. The mapping works just fine without Core Data. 3. Just mapping the keys from JSON to object. 4. I don't want User to be a managedObject. However I still want the user be an attribute of the message class. 5. I want to map it out of the response. I only need the user it if the client is online. Otherwise the information is not neccessary Thank you for trying to help. Still could not figure it out and RestKit documentation is not really helping. - Sebastian Borggrewe
You really need to add details to your question. Show your user and mapping code. Probably also an image of your Core Data model. No one can guess what is going wrong otherwise. - Wain

1 Answers

0
votes

I found the problem. I forgot to set the class of my NSManagedObject to Message in my momd file and therefore it could not find the attribute that has not been defined in the data model.