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

  • Home
  • SEARCH
  • 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 7996195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:38:52+00:00 2026-06-04T14:38:52+00:00

I’m getting a Cocoa error 1570 while trying to store data in a core

  • 0

I’m getting a Cocoa error 1570 while trying to store data in a core data object that has a to-many relationship.

There error from the log file:

2012-05-25 12:02:38.919 TestProject[5059:12e03]   DetailedError: {
    NSLocalizedDescription = "The operation couldn\U2019t be completed. (Cocoa error 1570.)";
    NSValidationErrorKey = conversation;
    NSValidationErrorObject = "<Messages: 0x933e190> (entity: Messages; id: 0x933e1d0 <x-coredata:///Messages/tF3A62C22-456B-41EB-B9A4-0BA1E6738A6337> ; data: {\n    conversation = nil;\n    conversationID = nil;\n    createdAt = nil;\n    messageID = nil;\n    nickname = nil;\n    originNetwork = nil;\n    text = nil;\n    timestamp = nil;\n    userImageURL = nil;\n})";
}

The specific relationship is Conversations<—>>Messages, or one conversation can have multiple messages, and each message belongs to exactly one conversation.

In my model, both of these NSManagedObjects are optional.

My question is, how do I properly store a message object in conversation?

I know it has something to do with sets, but I have yet to implement it properly.

Any and all specific or abstract code-snippets would be much appreciated!

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-06-04T14:38:54+00:00Added an answer on June 4, 2026 at 2:38 pm

    It depends on whether you’re using NSManagedObject subclasses or not. If you are (I like to do this), you’d have a ASConversation and ASMessage class (prefixes being whatever), then you have Xcode auto-generate them for you, and you can use something like:

    NSManagedObjectContext *moc;  // exists 
    ASConversation *conv = 
        [NSEntityDescription insertNewObjectForEntityForName:@"Conversation" 
                                      inManagedObjectContext:moc];
    // … set values on the conv
    ASMessage *msg = 
        [NSEntityDescription insertNewObjectForEntityForName:@"Message" 
                                      inManagedObjectContext:moc];
    // … set other parts of the message
    
    [conv addMessagesObject:msg];
    

    Provided you have the inverse relationship set up correctly from Message back to Conversation as a to-one, all should be set up for you when you send save to the moc.

    If you don’t have subclasses, you’d have to use the generic way, a bit more of a pain IMHO.

    // Assume conv and msg exist as above, but both are of NSManagedObject types
    NSMutableSet *set = [conv mutableSetValueForKey:@"messages"];
    // Changes to the above set are managed by Core Data for you.
    [set addObject:msg];
    

    Then save as before. Do check that you have optional also set on the relationship – cocoa error 1570 is “mandatory value not set” – but it can apply to relationships too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

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.