Questions tagged [key-value-observing]

Key-value Observing or KVO is a technology for observing changes in object properties.

1201 questions
-1
votes
2 answers

Class is deallocating while KVOs are still registered

I've been trying to pinpoint the problem but have not been able to do so because it's very hard to reproduce. Here's the error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x1455c7fa0 of class…
Vee
  • 1,821
  • 3
  • 36
  • 60
-1
votes
1 answer

object of NSOperation doesn't removed from NSOperationQueue after executing

In my subclass of NSOperation I set 4 flags, and when an operation finishes its execution it is not removed to NSOperation queue, where it was added at the beginning, this thing cause a lot of issues in my app. I suppose that the way I set these…
Melany
  • 466
  • 7
  • 20
-1
votes
1 answer

Call a method on a property

Is there any way to call or pass a method on a property. I understand how to set and get properties but how do I manipulate them? I'm trying to remove punctuation on string using object oriented programing. The act of removing punctuation from an…
-1
votes
1 answer

is KVO still "broken"?

I let down KVO pattern since I read this : KVO vs NSNotification vs protocol/delegates?, where it uses a hard word : "broken", refering to an interesting article from Mike Ash relating three API design problem in 2011. I can't find any news after…
Jan ATAC
  • 1,212
  • 1
  • 18
  • 36
-1
votes
1 answer

How do I prevent exception" An instance was deallocated while key value observers were still registered with it." when I don't know the observer?

I'm getting the following KVO NSInternalInconsistencyException > An instance 0x61800005a610 of class portController was deallocated > while key value observers were still registered with it. Current > observation info: "
Elise van Looij
  • 4,162
  • 3
  • 29
  • 52
-1
votes
1 answer

Change object on KVO path

I have an object A, which have a property B. B is an object that have a property C of type int. Then in another object, I use KVO to observe object A with keypath B.C. If I change value of C, then I can receive notification fine. But if I assign…
it4rb
  • 166
  • 1
  • 9
-1
votes
1 answer

KVO on coreData object

I can't figure out how to simple observe change in one object property, that's not working as expected. Here my code: - (void)observeBasketValueChane:(MyObject*)theObject{ [theObject addObserver: self forKeyPath: @"value" …
Mr Bonjour
  • 3,330
  • 2
  • 23
  • 46
-1
votes
1 answer

KVO NSKeyValueObserving

I want to make Observing for NSString of Custom class. //add [self.sourceUser addObserver:[self appDelegate] forKeyPath:@"uJid" options:0 context:nil]; //remove [self.sourceUser removeObserver:[self appDelegate] forKeyPath:@"uJid"…
-1
votes
1 answer

Sign In change to Sign out when is logged in

Sorry it abit long,hope you guys understand I have a list of items in my tableView which it is JASidePanelController Eg: @menu = { 'menu' => ['Item1','Sign In'] } This list will be in every of my cell. When I perform Sign In action successfully,…
Nich
  • 1,112
  • 1
  • 14
  • 29
-1
votes
1 answer

Key-Value Observing in iOS. Error in changes dictionary

I subscribed one object for some changes from another object like this: [objA addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; And when changes are made the…
leon4ic
  • 339
  • 4
  • 12
-2
votes
1 answer

KVO publisher does not send signal on property change

I've just started learning Combine and am quite confused with behaviour of KVO publishers. They just do not publish any events except for the initial value. Here is the sample code I used: @objc class SampleClass: NSObject { @objc var name:…
nrx
  • 350
  • 4
  • 10
-2
votes
1 answer

iOS - Callback everytime the displayed view changes

I would like to know if there is anyway I could get a callback everytime the displayed view changes and receive the newly displayed view as a parameter of the callback? Can this be achieved with the key-value observing protocol? Here is more…
Dominic Jodoin
  • 2,538
  • 18
  • 21
-2
votes
1 answer

KVO working on this code

To better understand KVO, I created a simple application with 1 button and 2 very basic model classes: Book and Author. I want to trigger the Book when the Author changes. For example, A simple KVO example, why doesn't this trigger the…
-2
votes
2 answers

Can I get by by without ever using KVO?

Strange grammar, but I want to ask if there are cases where if I don't KVO (Key Value Observation), the app just can't do certain things/features? Thanks
mskw
  • 10,063
  • 9
  • 42
  • 64
-3
votes
1 answer

How do i get rid of Objective-C's KVO in Swift?

Swift version 5.3.1 Xcode 12.2 As title. When I update delta.a.value or delta.b.value that will auto calculate delta.value. Delta.value is related to UI Is it a good way in Swift? struct Component { var value = 0 } struct Delta { let a:…
CocoaUser
  • 1,361
  • 1
  • 15
  • 30
1 2 3
80
81