Cascade delete does not work

Originator:darren.mo
Number:rdar://FB13445046 Date Originated:2023-12-04
Status:Closed Resolved:iOS 18
Product:SwiftData Product Version:iOS 17.2 Seed 3 (21C5046c)
Classification:Incorrect/Unexpected Behavior Reproducible:Always
 
I have attached a sample project demonstrating the usage of `DeleteRule.cascade` on a one-to-many relationship. The cascade delete does not work. Only the objects that I explicitly specify to be deleted are actually deleted and the other side of the relationship is set to `nil`.

Comments

Apple

We were not reproducing this behavior on iOS 18.

Please verify this issue with iOS 18 Beta and update your bug report with your results by logging into https://feedbackassistant.apple.com/ or by using the Feedback Assistant app.

iOS 18 Beta (Build: 22A5282m) https://developer.apple.com/download/ Posted Date: June 10, 2024

If resolved, you can close your feedback by choosing the Close Feedback menu item in the Actions pop-up in Feedback Assistant.

If the issue persists, please attach a new sysdiagnose captured in the latest build and attach it to the bug report. Thank you.

iOS sysdiagnose Instructions: https://developer.apple.com/services-account/download?path=/iOS/iOS_Logs/sysdiagnose_Logging_Instructions.pdf


For a complete list of logging instructions, visit: https://developer.apple.com/bug-reporting/profiles-and-logs/

Apple

After reviewing your feedback, we have some additional information for you, or some additional information, or action is necessary for this issue:

We checked the store before and after the deletion of the parent was performed and the delete cascades- objects from both sides of the relationship are deleted. Tested with the sample application provided.

Please close this feedback report, if there's nothing else you need from us here.

By darren.mo at May 1, 2024, 4:34 a.m. (reply...)

Me

I am still able to reproduce the issue with iOS 17.5 Beta 2. See the attached screenshot. I have circled the issue in red. After deleting the parent, the child is still alive and its parent relationship is set to nil.

Are you sure you checked the right store? The sample application uses an in-memory store.

By darren.mo at May 1, 2024, 4:34 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!