Skip to content

Crash with error: Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff86533e38) #226

Open

Description

@vivek4292

Describe the bug
When I was using 1.2.0 and Xcode 10.2 it was working fine. As I switched to Xcode 11.2 and 1.4.0 version of Instruction. I found a crash while assigning a delegate to CoachMarksController instance.

To Reproduce
Assign a delegate to an instance of CoachMarksController. In Xcode 11.2

Expected behavior
It should display coach mark views smoothly.

Screenshots
Screenshot 2019-11-12 at 5 40 40 PM

Environment:

  • Xcode: 11.2
  • Device: e.g. iPad 9.7- inch
  • iOS version: 13.2
  • Dependency Manager: Carthage

Activity

  1. ephread commented on Nov 22, 2019

    @ephread
    Owner

    Hey @vivek4292, thanks for reporting the issue. I'm unable to reproduce it, would you be able to provide a sample project demonstrating the crash?

  2. vivek4292 commented on Nov 27, 2019

    @vivek4292
    Author

    Hey, @ephread thanks for the response. I tried this in a separate project with the same environment and it is working fine. But it's still not working in my project.
    Screenshot 2019-11-27 at 5 58 45 PM
    In the above screenshot:
    I'm instantiating an object of CoachMarksController() and passing to a class-level variable.
    In the next line, you can see I'm assigning a data source to it. At that moment I checked if its reference is available in memory, I found It was available(see console).
    When I move to the next line, I found its data source was nil. Datasource was not assigned.
    Moreover, when I checked its memory reference (see console). It was missing and showing error:

    "error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x6).
    The process has been returned to the state before expression evaluation"
    .

    The moment I released the breakpoint, the app got crashed on the same line (like the previous screenshot).
    Please help.

  3. ephread commented on Dec 1, 2019

    @ephread
    Owner

    I'm instantiating an object of CoachMarksController() and passing to a class-level variable.
    In the next line, you can see I'm assigning a data source to it.

    This may be a trivial question, but how and where is coacher declared? Asking because it looks a lot like an object that is released too soon.

  4. vivek4292 commented on Dec 2, 2019

    @vivek4292
    Author

    @ephread Yeah it's a trivial question but I can understand in such case anyone can think of this possible reason. Agreed, it looks like an object is getting released soon.
    At first, I declared coacher at class level as lazy.
    Screenshot 2019-12-02 at 12 17 16 PM
    It was instantiated on first use(not in ViewDidLoad) and it was working fine till I was using Xcode 11.1 When I migrated this to Xcode 11.2.1 It started causing a crash. My thoughts were the same about releasing the object soon so I tried not to use lazy, instantiating in ViedDidLoad(), even instantiate a fresh object in ViewDidLoad() and not using a class-level variable.
    Screenshot 2019-12-02 at 12 21 45 PM

    But the crash is still there.

  5. kadm91 commented on Jun 29, 2022

    @kadm91

    I had the same problem with a project I am working on, I solve it by moving the code that was causing the bug to the main queue since that code was directly related to UI. this was in Xcode 13.

  6. tru110799 commented on Apr 26, 2023

    @tru110799

    How do you move the code to main queue? where do I find the main queue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions