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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:18:25+00:00 2026-05-31T21:18:25+00:00

I have been trying to develop a Core Data piece of code and have

  • 0

I have been trying to develop a Core Data piece of code and have been running into problems. In one version of my code everything works but after i have been trying to polish the code, i have the old version, and suddenly it does not work. I have not changed this class, which is why i am puzzled.

In the original version i get the output that can be seen in the bottom of this post, this is only one line, which is the database. In this version i get nothing.

I have a feeling it can be some problems with the connection between the app and Core Data. I did do a rename of the application via “Project -> Rename” so maybe that is the reason for this problem? I am afraid i do not know where to look.

EDIT: Just saw that the xcdatamodel have the old name!

EDIT2: Did rename a copy of the old version and got the same problem so i would guess the reason for this problem is the rename of the application. Now i am wondering how to align the Core Data database with the new name?

// Define qContext
NSManagedObjectContext *qContext = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription 
                               entityForName:@"questions" inManagedObjectContext:qContext];
[fetchRequest setEntity:entity];

NSArray *fetchedObjects = [qContext executeFetchRequest:fetchRequest error:&error];

for (NSManagedObject *info in fetchedObjects) {
...

2011-01-24 20:58:38.969 FamQuiz_v2[27431:207] fetchedObjects: (
” (entity: questions; id: 0x7088740 ; data: )”, …

=====================================

=============== UPDATE ==============

I did test if there is any data in the other parameters with the following code:

//=========PREPARE CORE DATA DB===========//
if (managedObjectContext == nil) { managedObjectContext = [(FamQuiz_v2AppDelegate *)
                                                           [[UIApplication sharedApplication] delegate] managedObjectContext]; }
// Define qContext
NSManagedObjectContext *qContext = [self managedObjectContext];

NSLog(@" ");
NSLog(@"qContext: %@", qContext);
NSLog(@" ");

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription 
                               entityForName:@"questions" inManagedObjectContext:qContext];
NSLog(@" ");
NSLog(@"entity: %@", entity);
NSLog(@" ");

[fetchRequest setEntity:entity];

NSLog(@" ");
NSLog(@"fetchRequest: %@", fetchRequest);
NSLog(@" ");




//>>>>ERROR COMING HERE


NSArray *fetchedObjects = [qContext executeFetchRequest:fetchRequest error:&error];
NSLog(@"fetchedObjects: %@", fetchedObjects);
NSLog(@"====STOP====");

The result is below and indicate that i do have access to the database, or? But still no “fetchedObjects”:

2011-01-24 22:27:54.094 FamQuiz_R0_2[29523:207] qContext:
2011-01-24 22:27:54.095 FamQuiz_R0_2[29523:207]
2011-01-24 22:27:54.095 FamQuiz_R0_2[29523:207]
2011-01-24 22:27:54.120 FamQuiz_R0_2[29523:207] entity: () name questions, managedObjectClassName NSManagedObject, renamingIdentifier questions, isAbstract 0, superentity name (null), properties {
idQ = “(), name idQ, isOptional 0, isTransient 0, entity questions, renamingIdentifier idQ, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 200 , attributeValueClassName NSNumber, defaultValue (null)”;
qDiff = “(), name qDiff, isOptional 0, isTransient 0, entity questions, renamingIdentifier qDiff, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 200 , attributeValueClassName NSNumber, defaultValue (null)”;
qNrAccess = “(), name qNrAccess, isOptional 0, isTransient 0, entity questions, renamingIdentifier qNrAccess, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 200 , attributeValueClassName NSNumber, defaultValue (null)”;
qRegDate = “(), name qRegDate, isOptional 0, isTransient 0, entity questions, renamingIdentifier qRegDate, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 900 , attributeValueClassName NSDate, defaultValue (null)”;
qRightAnswer = “(), name qRightAnswer, isOptional 0, isTransient 0, entity questions, renamingIdentifier qRightAnswer, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 700 , attributeValueClassName NSString, defaultValue (null)”;
qWrongAnswer1 = “(), name qWrongAnswer1, isOptional 0, isTransient 0, entity questions, renamingIdentifier qWrongAnswer1, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 700 , attributeValueClassName NSString, defaultValue (null)”;
qWrongAnswer2 = “(), name qWrongAnswer2, isOptional 0, isTransient 0, entity questions, renamingIdentifier qWrongAnswer2, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 700 , attributeValueClassName NSString, defaultValue (null)”;
question = “(), name question, isOptional 0, isTransient 0, entity questions, renamingIdentifier question, validation predicates (\n), warnings (\n), versionHashModifier (null), attributeType 700 , attributeValueClassName NSString, defaultValue (null)”;
}, subentities {
}, userInfo {
}, versionHashModifier (null)
2011-01-24 22:27:54.121 FamQuiz_R0_2[29523:207]
2011-01-24 22:27:54.123 FamQuiz_R0_2[29523:207]
2011-01-24 22:27:54.123 FamQuiz_R0_2[29523:207] fetchRequest: (entity: questions; predicate: ((null)); sortDescriptors: ((null)); type: NSManagedObjectResultType; )
2011-01-24 22:27:54.124 FamQuiz_R0_2[29523:207]
2011-01-24 22:27:54.125 FamQuiz_R0_2[29523:207] fetchedObjects: (
)
2011-01-24 22:27:54.126 FamQuiz_R0_2[29523:207] ====STOP====

===========UPDATE2==========

Here the code is:

- (NSManagedObjectModel *)managedObjectModel {

if (managedObjectModel_ != nil) {
    return managedObjectModel_;
}
NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"FamQuiz_v2" ofType:@"momd"];
NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
managedObjectModel_ = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];    
return managedObjectModel_;

}

=============== UPDATE-3 ==============

I am really puzzled about this problem but did test to rename the app back to the original name and then i worked. For me this means that there is a connection somewhere that i cannot find, and i have been looking.

I REALLY would like to understand how to rename an app with Core Data without loosing the connection to the database.

I would very much appreciate if anyone could spread some light on this as i would need to rename it.

=============== UPDATE-4 ==============

Just to give an update on this problem, I never succeeded to get this thing working so i decided to use the ‘opportunity’ to rewrite the whole application. May sound like a harsh way of solving this problem but as being very new to programming it also allowed me to clean up the code.

I am still very interested how to solve the problem.

  • 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-31T21:18:26+00:00Added an answer on May 31, 2026 at 9:18 pm

    In a terminal navigate into the project directory and actually cd into the .xcodeproj file itself. Edit the project.pbxproj file with vi and change all the occurrences of the former name to the updated one. It seems that Xcode doesn’t know to update all of the Core Data references, but this worked for me.

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

Sidebar

Related Questions

I have been trying to develop some user controls, one being a text edit
I have been trying to develop a 3D data-visualization software, and now I need
I have been trying to develop a peer to peer application that uses Micosoft's
I have been trying to develop an app for my ipad which i can
I have been trying to develop a Java ME application using WTK 2.5.2 (Java
I have been trying to develop an application in a landscape mode so I
I have been trying to develop a CustomButton class that extends MovieClip, however I
int duplicate (int cards[5][4][13]) I have been trying to develop a function (the prototype
I have been trying to develop an app that will deal with content providers
We recently started using Eclipse to develop our java application and have been running

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.