ios 线程 1:EXC_BAD_ACCESS(代码 = 1,地址 = 0x30000008)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19217233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 02:08:21  来源:igfitidea点击:

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

iosxcode

提问by user2767343

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.

我仍然坚持这个问题,甚至遵循了这个论坛的所有答案。谁能以简单的方式告诉我该怎么做?我是 xcode 的新手。我已启用僵尸对象。

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.

在我的应用程序中,我有多个 ViewController。当我单击 UINavigationBar 的后退按钮时,会生成此类问题,我无法解释我的问题,因为所有功能都正常工作。

Example :-

例子 :-

1 - fitstVController (work properly)

1 - fitstVController(正常工作)

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

=> 它有 UITableView ,当我点击特定的行然后它会在另一个 UIViewController (SecoundViewController)

2 - SecoundViewController (work properly)

2-SecoundViewController(正常工作)

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

=> 它有 UITableView 和 UIActionSheet。当我选择 UiActionSheet 的按钮时,另一个 UIViewController (ThirdViewController) 被打开

3 - ThirdViewController (cannot open)

3 - ThirdViewController(无法打开)

=> 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

=> 当我点击第三行时出现错误。同样,如果我点击其他单元格,我点击的第三个单元格会在进入其他页面之前崩溃

回答by Rob

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 static analyzer ("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 Breakpointand 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 Configurationsettings.

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

  1. 我建议通过静态分析器(Xcode“产品”菜单上的“分析”)运行您的代码,并确保不提供任何警告。这将(除其他外)识别许多很容易困扰非 ARC 代码的常规内存问题。在您获得一份健康的健康账单之前,没有必要再进一步。

  2. 我建议打开异常断点,看看它是否标识了作为问题根源的特定代码行。有时,这可以识别代码行,而无需通过查看堆栈跟踪对发生错误的位置进行逆向工程。

  3. 鉴于您正在执行非 ARC 代码,您可能还想暂时打开僵尸程序。您可以在Scheme Configuration设置中看到此设置。

  4. 除此之外,我会向您推荐 Ray Wenderlich 的文章My App Crashed, Now What?.

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

如果您仍然有错误,请与我们分享堆栈跟踪。

回答by escapedcanadian

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

我在使用可重用视图 /XIB 时遇到此错误,并且有两个错误的组合:

  • 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

在 Identity Inspector 中指定视图类更正了错误

回答by GrandSteph

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

当对象仍在访问它时,您可能已经解除了 ViewController。那是我的问题,阅读罗布的回答有帮助。

回答by al_mukthar

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

这种类型的问题通常是由于内存释放/分配而发生的

Go to

Product -> Clean

产品 -> 清洁

will fix this problem in most cases

在大多数情况下会解决这个问题