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

KVO crash #119

Open
justFI opened this issue Feb 21, 2022 · 7 comments
Open

KVO crash #119

justFI opened this issue Feb 21, 2022 · 7 comments

Comments

@justFI
Copy link

justFI commented Feb 21, 2022

Describe the bug
App启动使用了AVPlayer播放视频,并添加了Observer 监听 其status
[self.playerItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
在页面 dealloc 也 remove了
[self.playerItem removeObserver:self forKeyPath:@"status"];

但 在进入App时 ,crahsh了。
这个本地调试 crash的信息
image
image
image
image

偶发性。但线上版本也会发生。下面时 bugly的 报告。
image

  • Device: iPhone8- 本地测试机型 非线上机型
  • OS: iOS14.3
@jezzmemo
Copy link
Owner

JJException什么版本?

@justFI
Copy link
Author

justFI commented Feb 25, 2022

JJException什么版本?

  • JJException (0.2.11):
    • JJException/All (= 0.2.11)
  • JJException/All (0.2.11):
    • JJException/ARC
    • JJException/DeallocBlock
    • JJException/Main
    • JJException/MRC
    • JJException/Swizzle
  • JJException/ARC (0.2.11):
    • JJException/DeallocBlock
    • JJException/Main
    • JJException/Swizzle
  • JJException/DeallocBlock (0.2.11)
  • JJException/Main (0.2.11)
  • JJException/MRC (0.2.11):
    • JJException/Main
    • JJException/Swizzle
  • JJException/Swizzle (0.2.11)

@songzhiming
Copy link

@jezzmemo iOS11之后,kvo不需要remove了。 可以不hook kvo了。

@jezzmemo
Copy link
Owner

嗯我也是这么考虑的,我后面可以发个版本!

@Creolophus
Copy link

嗯我也是这么考虑的,我后面可以发个版本!

请问最近有更新计划吗,我们也碰到了这个问题

@StevenFJW
Copy link

我也遇到信号量还在使用就已经释放问题.
dealloc里可不可以这样写

  • (void)dealloc{
    dispatch_semaphore_wait(self.kvoLock, DISPATCH_TIME_FOREVER);
    [self.kvoObjectSet release];
    dispatch_semaphore_signal(self.kvoLock);
    dispatch_release(self.kvoLock);
    [super dealloc];
    }

@StevenFJW
Copy link

@jezzmemo

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

5 participants