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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:43:37+00:00 2026-05-31T08:43:37+00:00

First let me explain the flow of my app, When I launch the app

  • 0

First let me explain the flow of my app,

When I launch the app I check if the user is logged in, I do this check in -(void) viewWillAppear:(BOOL)animated if not I show the login controller. Now this works perfectly.

In my loadView I access my Code Data stack and try and get the fetchedObjects to show in a table view, by clicking one of the cells I show more information on the clicked cell’s object.

This is how I do it.

AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [app managedObjectContext];
NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Sites" inManagedObjectContext:context];
NSError *error;

[fetchRequest setEntity:entity];

fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];

Now when the view loads the first time i get the following in the debugger

(lldb) po fetchedObjects
(NSArray *) $1 = 0x00352860 <_PFArray 0x352860>(
<NSManagedObject: 0x352550> (entity: Sites; id: 0x34c9b0 <x-coredata://7CD0A735-BC41-4E7A-8B07-C957E6096320/Sites/p1> ; data: <fault>)
)

Which appears to be fine.

Now viewWillAppear gets called and the login view gets shown and the user gets logged in and the login view is popped from the navigation stack, then the tableview’s cellforrowatindexpath gets called again, when I break there and I po my fetchedObjects again I get

(lldb) po fetchedObjects
(NSArray *) $3 = 0x00352860 [no Objective-C description available]

This I don’t understand, why does the data not get persisted?

The exception gets thrown in

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [fetchedObjects count];
}

fetchedObjects is a member of the class, I have no release for it yet and I never change its value?

  • 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-31T08:43:38+00:00Added an answer on May 31, 2026 at 8:43 am
    fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
    

    Returns an autoreleased object. If you want it to hang around, you have to retain it or assign it via your retained property accessor, if it exists (this is the preferred method):

    self.fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question might not seem programming related at first, but let me explain. I'm
That's the first time i get an error like this one, let me explain
First let me explain that I have this script that should let users enter
This might seem phrased oddly at first, but let me explain through example. Note
First let me explain the data flow I need Client connects and registers with
I've a not common problem to do a form validation. First let me explain
Well let me explain the code first: First the user enters the id, the
First let me explain how I currently handle validation, say, for an IPv4 address:
Alright let me explain my situation first: I am part of an organization that
First, let me explain what I am doing. I need to take an order,

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.