Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thread 1 : EXC_BAD_ACCESS (Code = 1, address = 0x30000008)

Tags:

xcode

ios

I still stuck on this problem even followed all the answer from this forum. can anyone tell me what to do in simple way? I'm new learner in xcode. I have enable the zombie object.

this is my coding that got crash

if ([[[AryStoreknowItem objectAtIndex:indexPath.row] objectForKey:@"action"] isEqualToString:@"a1"]) {

    NSString *t1 =[[AryStoreknowItem objectAtIndex:indexPath.row] objectForKey:@"title"];

    NSString *a1 = [[AryStoreknowItem objectAtIndex:indexPath.row] objectForKey:@"action"];

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    // saving an NSString
      [defaults setObject:a1 forKey:@"a1"];
      [defaults setObject:t1 forKey:@"t1"];

    JournalPage *journal=[[JournalPage alloc]initWithNibName:@"JournalPage" bundle:nil];

    [self presentModalViewController:journal animated:YES];

In my Application, I have multiple ViewController. when i click on back button of UINavigationBar then this type of issue generated , i can't explain my problem because all the functionality work proper.

Example :-

1 - fitstVController (work properly)

=> it have UITableView , when i click on specific row then it will be go on another UIViewController (SecoundViewController)

2 - SecoundViewController (work properly)

=> it have UITableView and UIActionSheet. when i select button of UiActionSheet then another UIViewController (ThirdViewController) is open

3 - ThirdViewController (cannot open)

=> error came when i click on row three. same goes if i click on other cell, the third cell that i click will got crash before in goes to other pages

like image 916
user2767343 Avatar asked Oct 07 '13 04:10

user2767343


4 Answers

This type of problem usually happens due to memory release/allocation

Go to

Product -> Clean

will fix this problem in most cases

like image 143
al_mukthar Avatar answered Dec 03 '22 15:12

al_mukthar


I don’t think we've got enough here to diagnose any particular problem (and it’s hard to follow your description). Nonetheless, I would recommend:

  1. I would suggest running your code through the static analyzer (shift+command+B or “Analyze” on the Xcode “Product” menu) and making sure that doesn't provide any warnings. That will (amongst other things) identify many routine memory issues that can easily plague non-ARC code. There's no point in going further until you get a clean bill of health here.

  2. I would suggest turning on the Exception Breakpoint and see if that identifies a particular line of code that is the source of the issue. Sometimes that can identify the line of code without having to reverse engineer where the error occurred by looking at the stack trace.

  3. Given that you're doing non-ARC code, you might also want to temporarily turn on zombies. You can see this setting the the Scheme Configuration settings.

  4. Beyond that, I’d refer you to Ray Wenderlich article My App Crashed, Now What?.

If you continue to have errors, share the stack trace with us.

like image 20
Rob Avatar answered Dec 03 '22 15:12

Rob


You might have dismissed a ViewController while an object is still accessing it. That was my issue and reading Rob's answer helped.

like image 27
GrandSteph Avatar answered Dec 03 '22 15:12

GrandSteph


I got this error when I was utilizing a reusable view /XIB and had the combination of two errors:

  • I forgot to specify the name of the custom class in the identity inspector

    enter image description here

  • I cast the view as my specific view class in its outlet

    enter image description here

Specifying the view class in the Identity Inspector corrected the error

like image 20
escapedcanadian Avatar answered Dec 03 '22 14:12

escapedcanadian