I am trying to find a way to save the data that was created by an object in core data that is deleted.
For example, I have an app that you can add teams. You can add players to that team. With that team you play games against other teams. The app records data from that game.
If I were to delete one of the teams that played in a game, how can I have the game still display all the data from the team regardless if it was deleted or not?
Don’t use a cascade delete relationship. If you do that then your data will still be there, you just won’t be able to access it through a team.
I don’t know what you’re trying to do, but consider NOT deleting the team. There are plenty of ways to make it look like it’s deleted (to the user) without actually deleting it from core data.
(edit) For instance, you might want to consider adding an attribute of type BOOL that would indicate whether the team is ‘active’ or not.
-Update-
It sounds like for your purposes you need to:
nilwhen the team is deleted.nilteam. You can do this whenever you no longer need the information