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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:17:57+00:00 2026-06-15T02:17:57+00:00

A simple guess would be because when we recently add the object we do

  • 0

A simple guess would be because when we recently add the object we do not know or do not have certain information to create the permanent ID.

Fine.

Then I read this:
obtainPermanentIDsForObjects:error:

Converts to permanent IDs the object IDs of the objects in a given array.
– (BOOL)obtainPermanentIDsForObjects:(NSArray )objects error:(NSError *)error

This method converts the object ID of each managed object in objects to a permanent ID. Although the object will have a permanent ID, it will still respond positively to isInserted until it is saved. Any object that already has a permanent ID is ignored.

Any object not already assigned to a store is assigned based on the same rules Core Data uses for assignment during a save operation (first writable store supporting the entity, and appropriate for the instance and its related items).
Special Considerations

Okay, so we got temporary ID until we save the NSManagedObject. However

Saving the managedObjectContext will not update the ID of the NSManagedObjects. it remain the same as this code shows:

PO([Catalogs convertEachElementToAnother:(id)^(id element) {
    BGCatalogData * data = (BGCatalogData*) element;
    NSManagedObjectID * theObjectID= data.objectID;
    return theObjectID;
}]);

NSError * error;
BOOL saveSuccesfully = [[BGMDCRManagedObjectContextThreadHandler managedObjectContext] save:&error];
PO([Catalogs convertEachElementToAnother:(id)^(id element){
    BGCatalogData * data = (BGCatalogData*) element;
    NSManagedObjectID * theObjectID= data.objectID;
    return theObjectID;
}]);'

Note to mod: I can’t convert the above into code

Which results in:

[Catalogs convertEachElementToAnother:(id)^(id element){ BGCatalogData * data = (BGCatalogData*) element; NSManagedObjectID * theObjectID= data.objectID; return theObjectID; }]: (
    "0x888a340 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A603>",
    "0x888d670 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A609>",
    "0x888ed50 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A615>",
    "0x888f690 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A621>"
)
2012-11-16 15:33:28.489 BadgerNew[26871:1d03] [Catalogs convertEachElementToAnother:(id)^(id element){ BGCatalogData * data = (BGCatalogData*) element; NSManagedObjectID * theObjectID= data.objectID; return theObjectID; }]: (
    "0x888a340 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A603>",
    "0x888d670 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A609>",
    "0x888ed50 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A615>",
    "0x888f690 <x-coredata:///BGCatalogData/t084E0F43-A129-4023-8190-2962D8D0930A621>"
)

We can give objects permanent ID by calling obtainPermanentIDsForObjects BEFORE the object is saved.

So why IOS bother waiting till saving to give permanent ID? Why not right away?

  • 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-15T02:17:58+00:00Added an answer on June 15, 2026 at 2:17 am

    because CoreData has to manipulate the underlying Persistant Store to ‘block’ the permanentIDs for other objects (increment a counter for example). If you do not need the permanentIDs before saving its an unnecessary and propably slow thing to do (you could use your items only temporary and never save it)

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

Sidebar

Related Questions

I have a situation which has to be simple to solve, I would guess.
A little stuck here. I have a simple question I guess. Given the following
I guess this is simple, but i couldnot figure it out. i have a
A fairly simple question for which I have a guess, but I can't find
I have a sql function that does a simple sql select statement: CREATE OR
EDIT: I rephrased the question because I have not explained well. Let's see if
Simple question I guess, but a fundamental one and I'm not sure of the
Simple question I guess, I want to use PHP to write an update to
This is a simple question,I guess, but I couldn't figure it out. How do
I guess this is a simple question. I need to do something like this:

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.