Search Results

Search found 1 results on 1 pages for 'maverick447'.

Page 1/1 | 1 

  • IOS : BAD ACCESS when trying to add a new Entity object

    - by Maverick447
    So i'm using coredata to model my relationships . This is the model in brief Type A can have one or more types of type B Type B has a inverse relationship of being associated with one of type A Type B can have one or more types of type C Type C has a inverse relationship of being associated with one of type B From a UI standpoint , I have a Navigation controller with controllers that successively sets up the first A object (VC-1) , then another viewcontroller (VC-2) creates a B object ( I pass in the A object to this controller) and the B object is added to the A object . Similarly the same thing happens with B and C . The third Viewcontroller (VC3) first creates a C object and assigns it to the passed B Object . Also between these viewcontrollers the managedObjectCOntext is also passed . SO my use case is such that while viewcontroller (VC-3) is the top controller a button action will keep creating multiple objects of type C and add them to the same type B object that was passed . Also as part of this function I save the managedObject context after saving each type C . e.g. code in viewcontroller 3 - (void) SaveNewTypeC { TypeC *newtypeC = (Question*)[NSEntityDescription insertNewObjectForEntityForName:@"TypeC" inManagedObjectContext:managedObjectContext]; [newtypeC setProp1:] ; [newtypeC setProp2:] .. .. **[typeBObject addTypeCInTypeBObject:newtypeC];** [section setTotalCObjectCount:[ NSNumber numberWithInt:typeCIndex++]]; NSError *error = nil; if (![managedObjectContext save:&error]) { // Handle error NSLog(@"Unresolved error %@, %@, %@", error, [error userInfo],[error localizedDescription]); exit(-1); // Fail } [newtypeC release]; } - (IBAction)selectedNewButton:(id)sender { [self SaveNewTypeC]; [self startRepeatingTimer]; } The BAD ACCESS seems to appear when the bold line above executes Relating to some HashValue . Any clues on resolving this would be helpful .

    Read the article

1