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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:07:24+00:00 2026-05-22T19:07:24+00:00

Kind of following this tutorial here: http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/ I use the fetch records method in

  • 0

Kind of following this tutorial here: http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/

I use the fetch records method in my AppNameDelegate.m file. I then call reload on my tableview. Unlike the linked tutorial, I am not using a UITableViewController. Instead, I have added a table view to the NavigationController, and connected it to the IBOutlet variable called contactsTable.

Here’s my code for calling and loading the data:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

    [self.window addSubview:[self.navigationController view]];
    [self fetchRecords];
    [self.contactsTable reloadData];
    [self.window makeKeyAndVisible];
}

The header file:

//
//  SimpleContactsAppDelegate.h
//  SimpleContacts
//
//  Created by Aaron McLeod on 11-05-28.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>

@interface SimpleContactsAppDelegate : NSObject <UIApplicationDelegate> {
    NSManagedObjectModel *managedObjectModel;
    NSManagedObjectContext *managedObjectContext;
    NSPersistentStoreCoordinator *persistentStoreCoordinator;    
    UIWindow *window;  
    UINavigationController *navigationController;
    // view for adding new contacts
    UIViewController *newContactView;
    UIButton *addButton;

    // controls for the addContactView
    UIButton *saveContactButton;
    UITextField *nameField;
    UITextField *emailField;
    UITextField *phoneField;

    UITableView *contactsTable;
    NSMutableArray *contactArray;
}

@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;  
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;  
@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@property (nonatomic, retain) IBOutlet UIButton *addButton;
@property (nonatomic, retain) IBOutlet UITableView *contactsTable;
@property (nonatomic, retain) NSMutableArray *contactArray;

// controller and fields for the form
@property (nonatomic, retain) IBOutlet UIViewController *newContactView;
@property (nonatomic, retain) IBOutlet UITextField *nameField;
@property (nonatomic, retain) IBOutlet UITextField *emailField;
@property (nonatomic, retain) IBOutlet UITextField *phoneField;
@property (nonatomic, retain) IBOutlet UIButton *saveContactButton;


- (NSString *)applicationDocumentsDirectory;
- (IBAction) saveContact;
- (IBAction) switchToAddContactView;
- (void)fetchRecords;
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView;
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

@end

You can find my project source code here as well: https://github.com/agmcleod/SimpleContacts/tree/parttwo In case i left out code you might need. 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-05-22T19:07:25+00:00Added an answer on May 22, 2026 at 7:07 pm

    The only thing reloadData does is tell the UITableView to ask its data source for new data. This means it’ll call numberOfSectionsInTableView: etc. Have you set up this relationship correctly?

    In your case, your SimpleContactsAppDelegate instance should be the dataSource of your table view (do the connection in Interface Builder).

    Consider using NSFetchedResultsController when using Core Data and UITableViews. This allows you to not load all the objects into memory at once, etc. Xcode’s sample code provides a good starting point for this (I think it’s the Navigation Controller based app with Core Data template).

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

Sidebar

Related Questions

imagine the following problem in grails you have some kind of audit trail domain
This the exception: java.lang.IllegalStateException: this kind of handler cannot be attached to multiple components;
I'm looking for a hacky kind of solution to the following problem: GCC 4.4+
Hey everybody. So, I'm creating this kind of a social network script for a
Let me know the best way to serialize my Java object Download. This is
In my iPhone app I have a UIScrollView with custom content views. At some
I researched this around and still can't seem to solve this problem. I have
Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,
I've run into some interesting code in our legacy application running under Internet Explorer.

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.