Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vivek4292 opened this issue Nov 12, 2019 · 6 comments

Comments

@vivek4292
Copy link

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
@ephread
Copy link
Owner

ephread commented Nov 22, 2019

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?

@vivek4292
Copy link
Author

vivek4292 commented Nov 27, 2019

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.

@ephread
Copy link
Owner

ephread commented Dec 1, 2019

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.

@vivek4292
Copy link
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.

@kadm91
Copy link

kadm91 commented Jun 29, 2022

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.

@tru110799
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants