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 3598474
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:14:47+00:00 2026-05-18T20:14:47+00:00

I have an NSManagedObject subclass which stores URIs of child objects. It initially stores

  • 0

I have an NSManagedObject subclass which stores URIs of child objects. It initially stores the temporary URI when a child object is first created, and implements -willSave to call -obtainPermanentIDsForObjects on its NSManagedObjectContext before saving, so that only the permanent ID is persisted.

The problem I’m running into, though, is that other instances also store the temporary URI. When one gets the -willSave message shortly after another object with the same child does, it also calls -obtainPermanentIDsForObjects and gets a different, wrong permanent URI, causing subsequent Core Data fault errors like:

CoreData could not fulfill a fault for '0x102e4c110 <x-coredata://E17EE19B-E7F3-4102-ACFF-3E6F8BE8B104/MyEntityName/p2>'

I would like a way to get from an NSManagedObject’s old, temporary, URIRepresentation to its new, permanent, URIRepresentation that was already generated.

My initial thought is to store my own dictionary of <temporary URI,permanent URI> and look up against that before using -obtainPermanentIDsForObjects – is there an easier (more foolproof or built-in) way that I’m missing? Nothing I found in the documentation suggested anything.

  • 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-18T20:14:48+00:00Added an answer on May 18, 2026 at 8:14 pm

    I ended up getting a permanent ID with the -obtainPermanentIDsForObjects call immediately after creating the child object, before it belongs to any parent. That way, the parent object never sees a temporary ID. This works, though I’m still anxious to hear if there are any better solutions.

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

Sidebar

Related Questions

In my Objective-C project I have a Country class (NSManagedObject subclass). When comparing a
I have a subclass of UIView which draws itself based on data held in
I have a custom NSManagedObject subclass, say, Person . I also have a UIView
I have an Offer class (NSManagedObject subclass) that I want to use to handle
I have a CoreData model (managed object) called Item: @interface Item : NSManagedObject {
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have had to write my first proper multithreaded coded recently, and realised just how
I am initializing a NSManagedObject subclass using: - (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues I am also knowingly
Suppose (for the sake of argument) that I have a view class which contains
I'm using a SQLite persistent store. I have a NSManagedObject class Den with a

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.