1

my app is based on core data using magical record.

In one of my tabelView with custom cell the user can see all his records and tap a button to add it to favorites ( basically changing a value of one string for the selected item).

after that i change the button image to give a feedback to the user.

This works, but sometimes the app crash (not always), and xcode doesn't output any error.

here my code for IBAction:

[[DataManager sharedClass] setFavorite:@"Sono un preferito" ofContactInCell:[sender tag]];


    UIButton *myButton = (UIButton *)sender;

    [myButton setImage:[UIImage imageNamed:@"AddPreferito"] forState:UIControlStateNormal];

and the method to change the value of the string:

-(void) setFavorite:(NSString*)setPreferito ofContactInCell:(int)cell
{

    NSManagedObjectContext *localContext    = [NSManagedObjectContext MR_contextForCurrentThread];
    NSArray* arra = [Ricetta MR_findAllSortedBy:@"nome" ascending:YES];
    Ricetta* personaTrovata = arra[cella];


        personaTrovata.preferito = setPreferito;

        [localContext MR_saveToPersistentStoreAndWait];

        [self.delegate ricaricaLaTable];

}

I think that the problem is in the image switching, but maybe I'm wrong. Help!

Totka
  • 627
  • 6
  • 24
  • 1
    please use instrument for checking possible leaks or zombie in your application . http://stackoverflow.com/questions/12098444/xcode-instruments-zombies-what-am-i-looking-for and http://stackoverflow.com/questions/6641540/xcode-4-how-to-profile-memory-usage-performance-with-instruments – KDeogharkar Jul 09 '13 at 10:42
  • Do you have signal SIGBRT error? – Tarek Hallak Jul 09 '13 at 10:43
  • @BaZinga if i run the app in the simulator it works. if I run the app on my iphone connected to Mac it works. If my iphone isn't connected sometimes crash. I tried with zombie but the app doesn't crash if is connected. – Totka Jul 09 '13 at 11:18
  • 1
    You can connect the iPhone and open organizer->device->device logs and see if the error will show up there. Also you can sign up to crashlytics and you can get errors from the app emailed or on their website – Yan Jul 09 '13 at 12:05
  • I get the crash inside the simulator!! Thread1:EXC_BREAKPOINT(code=EXC_I386_BPT, subcode = 0x0) – Totka Jul 10 '13 at 06:54
  • @BaZinga As expected, really stupid error: I didn't added the custom cell as subview. – Totka Jul 10 '13 at 09:56
  • @Yan As expected, really stupid error: I didn't added the custom cell as subview. – Totka Jul 10 '13 at 09:57

0 Answers0