I have an NSDictionary and a CoreData Database. I want to insert the NSDictionary into the database.
How can I do this (code snippets if possible)?
What is the suitable type for the attribute of the dictionary ?
You would need to serialize your NSDictionary to an NSData, CoreData can hold to NSData.
But you won't be able to search (predicate) element of your NSDictionary.
And if we think about this, NSDictionary is a collection of data.
A Table in a database is kind of a collection of data.
In CoreData the closest thing you got to a collection of data is NSManagedObject.
So my advice would be to make a NSManagedObject subclass that would hold the information you have in your NSDictionary. The key
would be the attribute and the value would be the value
of that attribute. And you would be able to search based on the attribute of that NSManagedObject subclass.