Group Group Group Group Group Group Group Group Group

Adding Reminders to Lists |

This is a companion discussion topic for the original entry at

Thank you for this tutorial! I learned a lot, especially regarding relationships. I’m trying to translate this information for my own app that I’m building but I’m having trouble representing a one-to-many relationship.

When I use ForEach to represent whats equivalent to your “reminderList.reminders”, my app crashes every time and gives me this message: -[_NSFaultingMutableSet objectAtIndex:]: unrecognized selector sent to instance".

I have analyzed your code and tried to replicate it with as much precision as I could in translation to my app but I just can’t figure out what the root of the issue is. I understand it’s very difficult to diagnose what the issue might be without seeing the code, but I was wondering if there is anything you can tell from that error message. Thank you!

ForEach uses an index to access elements and after a bit of Googling it looks like that error is generated when an index is used to access an unordered list. Typically CoreData models use NSSet as the attribute type, even if you check the ordered list option and this might be what’s causing the crash. Try changing the attribute type to a swift Array

It worked! I actually had the attribute type set to an array but based on your suggestion I realized I didn’t check off the attribute as “ordered” in the model inspector, now everything is running smoothly. Thank you!

1 Like