Ok so this question is two fold.
I am creating a bill reminder app and want to use CoreData to store all of the data (which I am new to). I have setup all of my entities and relationships (BillAccount one-to-many relationship with Bills). So an account can have many bills.
Question 1: So someone enters the account details and sets how many times the bill will repeat and taps save. How do I create the BillAccount object, then loop through and add all of the Bills for that BillAccount just added? I can easily add one bill and bill account but not sure how to add multiple bills to the one BillAccount.
Question 2: How can I add an additional Bill to an existing BillAccount after I have already created the BillAccount… so editing the bill not adding for the first time? Do have to firstly set the BillAccount object and get its uniqueID. I am a bit confused by this.
Some basic code examples would be great. Thanks for your help.
I am guessing (sorry if i am wrong) that you didn’t generate classes to your core data entities.
If not –
Now go to your project file system and locate the BillAccount entity class. you will find in the .h file that Xcode generated “CoreDataGeneratedAccessors” methods for you:
Now to your first question
Add the set to the bill account
And that’s it for adding many bills to one account.
As for your second question:
Now use this object to add the bills until the user selects different account.