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

有个问题请教一下,谢谢 #3

Closed
zengzihao4560 opened this issue Aug 16, 2018 · 8 comments
Closed

有个问题请教一下,谢谢 #3

zengzihao4560 opened this issue Aug 16, 2018 · 8 comments

Comments

@zengzihao4560
Copy link

我的需求是hook UIAlertAction里的点击block回调,用BlockHook的过程中碰到了self.block提前被释放,导致crash。我不知道是因为UIAlertController被释放的原因还是其他的原因.

@yulingtianxia
Copy link
Owner

@zengzihao4560 能贴下堆栈信息么?如果不用 BlockHook 还会 crash 么?

@zengzihao4560
Copy link
Author

不用的话是不会的。
image

@yulingtianxia
Copy link
Owner

@zengzihao4560 能发下你的代码和堆栈么

@zengzihao4560
Copy link
Author

zengzihao4560 commented Aug 16, 2018

@yulingtianxia 你好,发了一份demo给你g邮箱,有时间的话查收下。再次感谢

@yulingtianxia
Copy link
Owner

image
@zengzihao4560 这样改就 OK 了

@zengzihao4560
Copy link
Author

@yulingtianxia 我按照你说的改了, 但是这样改就不会红框内的方法了。
image

@yulingtianxia
Copy link
Owner

yulingtianxia commented Aug 16, 2018

@zengzihao4560 原因是这个 block 是栈 block 不是堆 block,手动 copy 下就可以。我会发个版本修复做下保护。
image

@zengzihao4560
Copy link
Author

@yulingtianxia 问题已经解决,多谢大佬!!!

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

2 participants