iphone - Keep getting sigabrt error with core data -


I am currently learning about core data and working on a simplified version of Apple's Core Data Tutorial I am here.

The code below addEvent method:

  Event * event = (Event *) [NSEntityDescription insertNewObjectForEntityForName: @ "event" Manage Objects Contact: Manage Objektkoret]; [Event Set Creation Date: [Date of NSDT]]; NSError * error; If (! [ManagedObjectContext save: & amp; error]) {// Error handling} [EventAurray.com object: Event on index: 0]; NSIndexPath * indexPath = [NSIndexPath IndexForFor: 0 in particular: 0]; [Self Telebl V Insert Roshniaetindakspathः [Ansaararaararedvibetः Indekspath] Vithrav animation: Uaitiblwuarvinanimeshnfed]; [Self.tableView scrollToRowAtIndexPath: [NSIndexPath indexPathForRow: 0 Menviseshta: 0] Prskrolpojisn: UITableViewScrollPositionTop animated: YES];   

When this method starts, I get a sygbert error. However, I have found that if I include the embedded code of apple, then the error is no longer and I Why can not I do this for life?

Here is the code that prevents the error:

  - (zero) viewDidoad {[Super Viewedload]; // Title Set Self.title = add @ "" location "; // Configure and edit button Self.navigationItem.leftBarButtonItem = self.editButtonItem; AddButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItem Add goal: self action: @ selector (addEvent)]; Self.navigationItem.rightBarButtonItem = addButton; / * get current events create a fetch request, find the event unit and assign it upon request; execute add a type of descriptors, then batch. * / NSFetchRequest * Request = [[NSFetchRequest alloc] init]; NSEntityDescription * unit = [NSEntityDescription EntityForName: @ Managed Object Contact in "Event": Managed Object Context]; [Request setEntity: Unit]; // The sequence of events from the date of creation, first of all, NSSortDescriptor * sortDescriptor = [[NSSortDescriptor alloc] initWithKey : @ "creation date" rising: No]; NSArray * sortDescriptors = [[NSArray alloc] initWithObjects: sortDescriptor, nil]; [request Associate Srtkt: Sort descriptor]; [Sortedipitre release]; [Sort descriptor release]; // execute fetch - create a temporary copy of the result NSError * Error = Zero; NSMutableArray * mutableFetchResults = [[managedObjectContext executeFetchRequest: Request error: & amp; Error] mutableCopy]; If (mutableFetchResults == zero) {// handle error. } // Set healthy events into unstable array, then clear [self set eventsresay: mutablefet-resal]; [MutableFetchResults release]; [Request release];   

What am I missing? I do not think the lack of fetch requests on viewDidLoad

thanks

How does the tableview know which incidents occur?

One side of Apple's visualloadload method is that this event array if you never make that, but you tell your desk that you have inserted a line, Will happen!

You are calling

  [EventAddress Object: Event On Index: 0];   

But I'm sure that without the exception viewDidload method, eventsArray is zero - you create It will be necessary if this is zero (i.e. eventsArray = [[NSMutableArray alloc] init];

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -