[Mono-osx] [MonoMac] NSMutableDictionary FromObjectsAndKeys problem
kjpou1
kjpou at pt.lu
Mon Nov 15 09:13:15 EST 2010
Hello all
I am working with a mutable dictionary with bindings to an ArrayController
and am having problems creating a NSMutableDictionary using the
FromObjectsAndKeys.
It works for a NSDictionary but not when creating a NSMutableDictionary.
The example code below shows what I am talking about.
var objects = new NSObject[3] {new NSString("AAAAA"),
new NSString("BBBBB"),
new NSString("CCCCCC")};
var keys = new NSObject[3] {new NSString("firstkey"),
new NSString("secondkey"),
new NSString("thirdkey")};
var dict2 = NSDictionary.FromObjectsAndKeys(objects,keys);
//var dict = NSMutableDictionary.FromObjectsAndKeys(objects, keys);
var dict = NSMutableDictionary.FromDictionary(dict2);
myContentArray.AddObject(dict);
The implementation between NSDictionary.cs and NSMutableDictionary.cs are
different for that method and not sure why.
Any help would be appreciated
Kenneth
----------------------------------
If you uncomment the //var dict =
NSMutableDictionary.FromObjectsAndKeys(objects, keys); it gives the
following error:
Stacktrace:
at (wrapper managed-to-native)
MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_int
(intptr,intptr,intptr,intptr,int) <0x00004>
at (wrapper managed-to-native)
MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_int
(intptr,intptr,intptr,intptr,int) <0x00004>
at MonoMac.Foundation.NSMutableDictionary.FromObjectsAndKeys
(MonoMac.Foundation.NSObject[],MonoMac.Foundation.NSObject[],int) <0x00067>
at MonoMac.Foundation.NSMutableDictionary.FromObjectsAndKeys
(MonoMac.Foundation.NSObject[],MonoMac.Foundation.NSObject[]) <0x00028>
at NSTableViewBinding.TestWindowController.AwakeFromNib () <0x001f8>
at (wrapper native-to-managed) object.92f48794-05ff-4e21-bcf0-61c0dd4bf42b
(MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector) <0x000cc>
at (wrapper managed-to-native)
MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr)
<0x00004>
at (wrapper managed-to-native)
MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr)
<0x00004>
at MonoMac.AppKit.NSWindowController.get_Window () <0x00079>
at NSTableViewBinding.TestWindowController.get_Window () <0x00012>
at NSTableViewBinding.AppDelegate.FinishedLaunching
(MonoMac.Foundation.NSObject) <0x00038>
at (wrapper native-to-managed) object.00860f4e-27a8-4ca0-aa64-ae2828705416
(MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
<0x00118>
at (wrapper managed-to-native)
MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00004>
at (wrapper managed-to-native)
MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00004>
at MonoMac.AppKit.NSApplication.Main (string[]) <0x00015>
at NSTableViewBinding.MainClass.Main (string[]) <0x00015>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0x00043>
--
View this message in context: http://mono.1490590.n4.nabble.com/MonoMac-NSMutableDictionary-FromObjectsAndKeys-problem-tp3043127p3043127.html
Sent from the Mono - OSX mailing list archive at Nabble.com.
More information about the Mono-osx
mailing list