I read some articles and info in developer.apple.com about Core Data. Now I want to create ManagedObjectModel for my app. So I need to help – because it’s first my planning about database. So my app will have next options
- User must login with his Login and Password. So if he forget password, there is chance to create new pass by entering correct answer on secret question.
- App will store contacts. Every contact have name, surname, photo, phones, and coollection of map annotations.
- User can create some groups (like Family, Friends…)
So this app I create for understanding basics of objective-c and maybe there are no logic in my app.
Please check my entities, maybe I allowed blunder.
First entity Contact

- id – number of contact.
- image – I will store array there. So if image <200 Kb I insert it in database, if more I will save the path to this image
- map – the dictionary of map annotations
- name
- phones – array of phone numbers
- surname
Second entity Group

- contacts – array that contain id of contacts, that belong to this group
- id – number of group
- title – it is the name of group (like Family, Friends…)
Third entity Login

- groups – array that contain id of groups, that belong to this group
- login
- password
- secret answer – answer to the secret question
- secret question
Relationships

So each Login can have some groups, but each group will belong only to one Login. So I create “to-many relationship” for group relationship. So each group contain some contacts and contacts can be in some different gruops – I create many-to-many relationship.
About property “optional”. I understand that if it’s not check – this attribute or relationship have to be. So I remove this property for
- “id” in Contact
- “id” in Group
- “login”, “password” in Login
- in relationship “toGroups” in Contact
- in relationship “toLogin” in Group
About “Delete Rule”. I want if I delete some Login all groups and contacts belong to this login must be delete. I can choose “Cascade” for relationship “group” in Login but it will delete only groups but not contacts. I cann’t do such for relationship “toContact” because if I delete some Group it will delete contacts, but other Groups still can have this contacts. So maybe I must create attribute “contact” in Login that will be array of contacts, and create relationship to Contacts and if I delete Login all groups and contacts that belong to it, will be delete.
PS Sorry I am stil newbie and my question maybe funny for you, but I need help
A few things I noticed –