Bug 19325 - NSArray missing AddObserver overload
Summary: NSArray missing AddObserver overload
Status: RESOLVED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Timothy Risi
URL:
Depends on:
Blocks:
 
Reported: 2014-04-27 22:19 UTC by John Lyon-Smith
Modified: 2016-02-19 00:38 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description John Lyon-Smith 2014-04-27 22:19:57 UTC
NSArray is missing the KVO override described here:

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/doc/uid/20000137-BBCDBGJD

Without this, observing an array requires that you call AddObserver repeatedly for each element in the array that you want to observe.
Comment 1 John Lyon-Smith 2014-04-27 22:21:06 UTC
OK, the link does not seem to be working.  The missing method is:

addObserver:toObjectsAtIndexes:forKeyPath:options:context:
Comment 2 Ram Chandra 2014-07-16 06:06:54 UTC
I have checked this issue and I am also getting the same behavior.

When I check the definition of "NSArray" class in "MonoMac.Foundation" namespace I observed that "addObserver:toObjectsAtIndexes:forKeyPath:options:context:" method is missing. When I check "Key-Value Observing" in apple doc i.e 

"https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/removeObserver:forKeyPath:" 

I observed that these KVO are declared in "NSKeyValueObserving.h" as mentioned in apple doc. I have also checked the definition of "NSKeyValueObserving" in assembly browser which is an "Enum" in xamarin and observed that these KVO are also missing in "NSKeyValueObserving" enum.

Screencast: http://www.screencast.com/t/ETkfaVelhx

Environment:

=== Xamarin Studio ===

Version 5.1.3 (build 0)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 3.6.0 ((no/5ff701f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000037

=== Xamarin.Android ===

Version: 4.12.5 (Enterprise Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: 7.2.5.5 (Enterprise Edition)
Hash: 87026b6
Branch: 
Build date: 2014-07-02 19:39:08-0400

=== Xamarin.Mac ===

Version: 1.8.0.8

=== Build Information ===

Release ID: 501030000
Git revision: 4676331632b3e5820ed4a92576594309907d778c
Build date: 2014-07-10 20:42:24-04
Xamarin addins: 571e972d874f74867110c205fc25b56048e7e93a

=== Operating System ===

Mac OS X 10.9.3
Darwin Jatin66s-iMac.local 13.2.0 Darwin Kernel Version 13.2.0
    Thu Apr 17 23:03:13 PDT 2014
    root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64
Comment 3 Timothy Risi 2016-02-19 00:36:16 UTC
Fixed on master / 162d5f8ad30a5af9d328eedd065bfbd216105b51