Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

is there any scenario for using KVOControllerNonRetaining? #136

Open
sjtupt opened this issue Mar 28, 2018 · 3 comments
Open

is there any scenario for using KVOControllerNonRetaining? #136

sjtupt opened this issue Mar 28, 2018 · 3 comments

Comments

@sjtupt
Copy link

sjtupt commented Mar 28, 2018

No description provided.

@rjinxx
Copy link

rjinxx commented Mar 28, 2018

[self.KVOController observe:self keyPath:@"date" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew action:@selector(updateClockWithDateChange:)];

like this, you observe 'self', if you're not using KVOControllerNonRetaining you'll get retain cycle issue

@sjtupt
Copy link
Author

sjtupt commented Mar 28, 2018

@RylanJIN got it. Thank you.

@djs66256
Copy link

KVOControllerNonRetaining is an ambiguous api.

[self.KVOControllerNonRetaining observe:self keyPath:@"date" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew action:@selector(updateClockWithDateChange:)];

It will crash. When self dealloc, weak table has already removed the self pointer, so you can not remove observer forever.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants