上一篇中讲到 观察NSArray 崩溃 ,看了一下文档,上面这样讲
NSArray objects are not observable, so this method raises an exception when invoked on an NSArray object. Instead of observing an array, observe the to-many relationship for which the array is the collection of related objects.
猜想 NSSet也会如此,果不其然
NSSet objects are not observable, so this method raises an exception when invoked on an NSSet object. Instead of observing a set, observe the unordered to-many relationship for which the set is the collection of related objects.
KVO 的本质是重写set方法,所以_xx=@"buasbuc" KVO 观察不到;
网友评论