Re: NSNumberFormatter issue with method -setLocale
Re: NSNumberFormatter issue with method -setLocale
- Subject: Re: NSNumberFormatter issue with method -setLocale
- From: Ulf Dunkel <email@hidden>
- Date: Fri, 25 Feb 2011 16:31:42 +0100
- Organization: invers Software
I have done some more research and trials, and now I wonder if
+[NSLocale autoupdatingCurrentLocale] does work at all. A warning in
Apple's Technical Q&A makes me wonder:
<http://developer.apple.com/library/ios/#qa/qa2010/qa1480.html>
I know this is an iOS Q&A and I am on Mac OS X, but ...
I have seen another, similar issue mentioned for GNUstep:
<http://old.nabble.com/Getting-NSUserDefaultsDidChangeNotification-notifications-td30795051.html>
Does anyone here use +[NSLocale autoupdatingCurrentLocale] in a Mac app
successfully, to be informed whenever the user has changed the System
Prefs settings for "Language & Text"?
The code mentioned below doesn't crash when I exchange
autoupdatingCurrentLocale by currentLocale, but of course I don't get
any new NSLocale parameters then.
- - - - -
On 24.02.2011 16:44, Ulf Dunkel wrote:
Mac OS 10.6.6 and Xcode 3.2.5:
I am playing with NSNumberFormatter stuff for various custom number edit
fields, which will e.g. be used to auto-format dpi values, degree
values, document measurement values with various format strings, etc.
I currently receive an EXC_BAD_ACCESS, with the following relevant code
lines in the relevant method:
- (id)init
{
[...]
[self setFormatterBehavior:NSNumberFormatterBehavior10_4];
return self;
}
- (void)setNewFormatString
{
NSLocale *autoLocale = [NSLocale autoupdatingCurrentLocale];
NSString *localeIdentifier = [autoLocale localeIdentifier];
NSLog(@"%@", localeIdentifier); // outputs e.g. "fr_CA"
[self setLocale:autoLocale]; //<-- EXC_BAD_ACCESS
// more formatting stuff
[...]
}
I cannot find what I am doing wrong. Can you help, please?
---Ulf Dunkel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden