I have two entities in my Core Data model: Library and Book. They are linked by a To Many relationship between Library and Book.
However, in my example I have the exact same book twice in my library and when I try to add them to my Library, only one appears. I search a bit and noticed that in the Library object, books are stored as a NSSet
.
Does anyone know how I could store the books in a NSArray
instead ?
You can't (well, unless you do away with the Book
entity and use a transformable attribute but that isn't a good solution).
The obvious choice would be to add a count
attribute onto your Book
entity so that you can record how many of that book you have. What impact this might have on the rest of your design is something you need to consider.