11

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

user2767343
  • 173
  • 1
  • 3
  • 12
  • ARC enabled? any other message from console? which line cause the problem? – Bryan Chen Oct 07 '13 at 04:58
  • 1
    You say it crashes when you go back to the previous view controller. Can you show us that code? You shared to code to go _to_ the next controller, but you didn't show us the code you run when you _return_ from that controller. – Rob Oct 07 '13 at 05:12
  • at the first line "if(...)" got problem.. ARC is disable..if i enable it got many error.. message from console: -[CFArray objectAtIndex:]: message sent to deallocated instance 0x1e5af140 thanx for ur trying to help – user2767343 Oct 07 '13 at 05:25
  • @Rob, sorry.. actually my problem same as post before, but a bit difference..se edit question above for the third view controller..fyi, i used same view controller when every row/cell is click..only the title is difference for every cell in the view controller..sorry for this stupid mistake – user2767343 Oct 07 '13 at 06:49

4 Answers4

16

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.

Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • thanx @Rob..i had run the static analyzer and 36 issue came out. i'll try to solve this and look like the article is great and related to this problem.. i appreciate ur help and inform u if this problem get solve..thanx again for ur time – user2767343 Oct 07 '13 at 08:28
2

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

GrandSteph
  • 2,053
  • 1
  • 16
  • 23
2

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

Go to

Product -> Clean

will fix this problem in most cases

ashif-ismail
  • 1,037
  • 17
  • 34
2

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

zx485
  • 28,498
  • 28
  • 50
  • 59
escapedcanadian
  • 283
  • 5
  • 10