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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:14:02+00:00 2026-05-17T01:14:02+00:00

I have a core-data object entity with 2 fields – name (a NSString *)

  • 0

I have a core-data object “entity” with 2 fields – “name” (a NSString *) and “type” (a EntityType). EntityType is another core data obect with 1 field – name (NSString *).
I am creating and deleting an entity object using the code similar in functionality to the following code –

Entity *e1 = [NSEntityDescription insertNewObjectForEntityName:"@Entity" inManagedObjectContext: context]

EntityType *type = [NSEntityDescription insertNewObjectForEntityName:"@EntityType" inManagedObjectContext: context]

e1.type = type;

Now I delete the entity object without assigning any values or saving to the persistent store.

if([e1.name length] == 0) {

  [context deleteObject:e1];

  NSError *nil;
  if(![context:save &error] {
    // log error
  }
}

At this point I see a crash, when I try to delete and save the object.
(Terminating due to uncaught exception ‘NSRangeException’ reason: [NSCFArray removeObjectAtIndex]: index(0) beyond bounds (0)]

Any pointers/suggestions are much appreciated.

Here’s the stack trace that was requested –

#0  0x3266bdf4 in objc_exception_throw ()
#1  0x32d73b32 in +[NSException raise:format:arguments:] ()
#2  0x32d73ad2 in +[NSException raise:format:] ()
#3  0x33f4a710 in _NSArrayRaiseBoundException ()
#4  0x33f7ba3c in -[NSCFArray removeObjectAtIndex:] ()
#5  0x30537dc6 in -[NSFetchedResultsController(PrivateMethods) _removeObjectInFetchedObjectsAtIndex:] ()
#6  0x3053b50a in -[NSFetchedResultsController(PrivateMethods) _postprocessDeletedObjects:] ()
#7  0x3053aa9a in -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] ()
#8  0x33f765d8 in _nsnote_callback ()
#9  0x32d9e510 in _CFXNotificationPostNotification ()
#10 0x33f741b2 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#11 0x304b4388 in -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] ()
#12 0x3050768a in -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] ()
#13 0x3049c2b0 in -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] ()
#14 0x304cb186 in -[NSManagedObjectContext save:] ()
#15 0x00006d5a in -[MyAppViewController goToMain] (self=0x11b730, _cmd=0x174b3) at /Users/Me/Projects/MyApp/Classes/MyAppViewController.m:611



2010-09-15 17:37:10.053 MyApp[1273:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray removeObjectAtIndex:]: index (0) beyond bounds (0)'
2010-09-15 17:37:10.066 MApp[1273:207] Stack: (
    853417245,
    845594132,
    852966195,
    852966099,
    ............
     .............
  • 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-17T01:14:03+00:00Added an answer on May 17, 2026 at 1:14 am

    The error is coming from the fetchedResults array of the FRC. I suspect this is caused by you not implementing the FRC delegate methods properly such that when the tableview tries to update, it tries to access the zero index of an empty array.

    When you have an FRC attached to any context, the FRC will update itself automatically when you make any change to context such as deleting an object (that is what the notifications in the trace stack are doing, telling the FRC to update.)

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

Sidebar

Related Questions

I have a Core Data entity, OrderItem that has a to-many relationship to another
I have a Core Data model entity NoteObject that has a transformable type arrayOfTags
In my Core Data managed object model, I have an entity Foo with a
I have a core data object and a REST web interface that use different
I have a core data UITableView, the core data managed object has 4 properties
I have a core data model object called Entry. In this I have an
I have the following core data model with two entities: entity item which holds
On my Core Data Entity Book i have a boolean property, 'wasViewed' (NSNumber numberWithBool)
I have a Core Data model in which a Task entity includes an optional
I have a Core Data entity, bid, which has a relationship to many items,

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.