Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4100438
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:34:00+00:00 2026-05-20T20:34:00+00:00

I have a fairly straightforward data model for a Core Data app. Basically, I’m

  • 0

I have a fairly straightforward data model for a Core Data app. Basically, I’m bringing up
a list of contacts already on the phone. When a user taps a contact, they’re taken
to a detail view screen, where they can select a phone number or email address. When they
select any detail item, I’m storing it via Core Data.

I have one entity called Contact, and another called Contact_Detail.

Contact <—–>> Contact_Detail

The Contact relationship to Contact_Detail has a delete rule of Deny.
The Contact_Detail relationship to Contact has a delete rule of No Action.

If a user wants to remove, say, a previously selected detail item, I first fetch the
Contact_Detail objects that have the same ID as the Contact. If there is only one Contact_Detail
object returned, I then know I need to remove the contact as well from the Contact entity. If there
were more than one Contact_Detail object returned, I just remove that particular object.

It’s all working fine, and the database is getting updated as expected (detail objects removed, and when the
last detail object for a particular contact is removed, so is the contact) as long as I just go back and forth
between the peoplePicker and the peopleDetailViewController.

The problem I’m having is that when I select an email address, leave the detailVC, leave the peoplePicker, then
return back to the peoplePicker, and back to the same contact, and deselect the email address I previously
selected, Core Data is throwing an error that looks as though it can’t delete my Contact because there are
still relationship objects (the Contact_Detail):

NSValidationErrorKey=details, NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1600.), NSValidationErrorValue=Relationship objects for {(
     (entity: Contact_Detail; id: 0xd21afe0  ; data: )
)} on 0x5d5a780}

I can verify that the Contact_Detail object does in fact get removed. Why can’t the Contact be removed? And why
does this only happen with a particular sequence of navigation?

Let me know if I should post some code. I think this problem is causing a crash I’m seeing after continuing to work with Core Data after this first error is thrown.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:34:01+00:00Added an answer on May 20, 2026 at 8:34 pm

    Why don’t you set delete rules in this way?

    Contact<--(cascade)-->>ContactDetail
    //when Contact is removed, all details are removed too)
    
    ContactDetail<<--(nullify)-->Contact
    //when Contact Detail is removed, this particular detail is removed from Contact too
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly straightforward graph with a date axis. All the date data
I have a fairly straightforward Java class here which creates 2 thread pools.... Connects
I have a fairly straightforward WCF service that performs one-way file synchronization for a
I have a fairly complex model for one of my pages; it's made of
I have a fairly basic data.table in R, with 250k rows and 90 columns.
My web app, up until this point, has been fairly straight forward. I have
I have a fairly straightforward page ( http://www.kwatee.net ) that renders ok with Firefox,
I have some fairly straightforward code to open up files using a Process object:
I think this is a fairly straightforward question but I have not been able
I currently have a fairly straight forward app, my first attempt at MVVM using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.