[iOS 4.2] NSDateFormatter -init not available in iOS > 3.2 - how to init then?
[iOS 4.2] NSDateFormatter -init not available in iOS > 3.2 - how to init then?
- Subject: [iOS 4.2] NSDateFormatter -init not available in iOS > 3.2 - how to init then?
- From: WT <email@hidden>
- Date: Sun, 12 Dec 2010 20:41:05 -0200
Hello,
according to the iOS 4.2 NSDateFormatter class documentation, the -init method is available in iOS 2.0 through iOS 3.2, but it does not offer an alternative method to initialize a newly allocated date formatter (or, if it does, I missed it on repeated readings of the docs). How then?
I went ahead and tried -init anyway and, sure enough, a problem arises:
malloc: *** error for object 0x4d6c9b0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Doing as suggested, I see the following call stack:
#0 0x916d1f82 in malloc_error_break
#1 0x915e1b63 in free
#2 0x0005aa09 in icu::DateFormatSymbols::dispose
#3 0x0005a98c in icu::DateFormatSymbols::~DateFormatSymbols
#4 0x0005a8a6 in icu::SimpleDateFormat::~SimpleDateFormat
#5 0x01165b39 in __CFDateFormatterDeallocate
#6 0x010e9bcb in _CFRelease
#7 0x002963ac in -[NSDateFormatter _regenerateFormatter]
#8 0x0000315d in -[AppDelegate dateFormatter] at AppDelegate.m:144
And here's the -[AppDelegate dateFormatter] method I have:
- (NSDateFormatter*) dateFormatter;
{
if (dateFormatter_ == nil)
{
dateFormatter_ = [[NSDateFormatter alloc] init];
[dateFormatter_ setLocale: self.localePtBr];
[dateFormatter_ setDateStyle: NSDateFormatterShortStyle];
}
return dateFormatter_;
}
Thanks in advance.
WT_______________________________________________
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