[MonoDevelop] App crashes NSNumberFormatter - LocalizedStringFromNumbernumberStyle

Annasaheb Rahane azr at qad.com
Tue Oct 11 16:02:13 EDT 2011


Hi all,

I am trying to localize an amount and display to user, but NSNumberformatter
crashes app, no idea how to resolve it, anyone has any idea?

Thanks in advance.

*Code Snippet:*

  NSNumberFormatter nm = new NSNumberFormatter();

 NSNumber nsm = new NSNumber(100);

 nm.FormatterBehavior = NSNumberFormatterBehavior.Default;

 nm.AlwaysShowsDecimalSeparator = true;

 nm.NumberStyle = NSNumberFormatterStyle.Currency;


Console.WriteLine(nm.LocalizedStringFromNumbernumberStyle(nsm,MonoTouch.Foundation.NSNumberFormatterStyle.Currency));

*Exception:*

Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C
exception thrown.  Name: NSInvalidArgumentException Reason:
-[NSNumberFormatter localizedStringFromNumber:numberStyle:]: unrecognized
selector sent to instance 0xa20e3b0

  at (wrapper managed-to-native)
MonoTouch.ObjCRuntime.Messaging:IntPtr_objc_msgSend_IntPtr_int
(intptr,intptr,intptr,int)
  at
MonoTouch.Foundation.NSNumberFormatter.LocalizedStringFromNumbernumberStyle
(MonoTouch.Foundation.NSNumber num, NSNumberFormatterStyle nstyle) [0x0001c]
in
/Developer/MonoTouch/Source/monotouch/src/Foundation/NSNumberFormatter.g.cs:221
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20111011/6ec4ccfd/attachment.html 


More information about the Monodevelop-list mailing list