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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:21:07+00:00 2026-05-13T11:21:07+00:00

Unfortunately, Apple did not test it’s tutorial at all. The Locations demo is really

  • 0

Unfortunately, Apple did not test it’s tutorial at all. The “Locations” demo is really buggy and the edit Button does not even exist. I have no typo. First I didn’t do copy & paste, and after that, I also attempted to just copy&paste their stuff. A lot of relevant code is completely missing.

They simply do this in view did load, without ever creating the edit button, anywhere:

- (void)viewDidLoad {

    [super viewDidLoad];

    // Set the title.
    self.title = @"Locations";

    // Configure the add and edit buttons.
    self.navigationItem.leftBarButtonItem = self.editButtonItem; // WTF?

    addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addEvent)];
    addButton.enabled = NO;
    self.navigationItem.rightBarButtonItem = addButton;

    // Start the location manager.
    [[self locationManager] startUpdatingLocation];

    /*
     Fetch existing events.
     Create a fetch request; find the Event entity and assign it to the request; add a sort descriptor; then execute the fetch.
     */
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:managedObjectContext];
    [request setEntity:entity];

    // Order the events by creation date, most recent first.
    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"creationDate" ascending:NO];
    NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
    [request setSortDescriptors:sortDescriptors];
    [sortDescriptor release];
    [sortDescriptors release];

    // Execute the fetch -- create a mutable copy of the result.
    NSError *error = nil;
    NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
    if (mutableFetchResults == nil) {
        // Handle the error.
    }

    // Set self's events array to the mutable array, then clean up.
    [self setEventsArray:mutableFetchResults];
    [mutableFetchResults release];
    [request release];
}

I went through the whole tutorial and it works so far, except that I can’t delete cells because they didn’t get that edit button right here.

I tried to fix that myself with this line in -viewDidLoad:

// Setup the buttons for the navigation bar
editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editEvent)];
self.navigationItem.leftBarButtonItem = editButton;

but now, what’s the implementation of the editEvent method has to look like? Unfortunately all this stuff is completely missing in the Core Data tutorial.

  • 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-13T11:21:08+00:00Added an answer on May 13, 2026 at 11:21 am

    Apple’s code is fine. Although editButtonItem is an instance method rather than a read-only property, the dot syntax still works (since dot syntax is just shorthand for method calls–usually accessors).

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

Sidebar

Related Questions

How does look the practical usage of IBOutletCollection? Unfortunately Apple documentation mentions it briefly
Unfortunately their Wiki is down for maintenance and the web is not being helpful.
Unfortunately I haven't coded Java for about five years and I absolutely can not
Unfortunately I am not writing this question from my Developing PC so I might
I can't figure out how to edit that part, and unfortunately i used ™
With Xcode 4.3.1, Apple ships the new iOS 5.1 Simulator. Unfortunately, it looks like
I'm grabbing app images from the iTunes affiliate program. Unfortunately Apple provides a square
To be clear, this is what I'm talking about: Unfortunately, Apple hasn't provided an
Starting with Snow Leopard (OS X v10.6) Apple bundles 64-bit ruby by default. Unfortunately,
because I did something really bad in the past, I have to insert an

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.