HopeRadio / google-api-objectivec-client

Automatically exported from code.google.com/p/google-api-objectivec-client
0 stars 0 forks source link

NSDateFormatter needs to have setFormatterBehavior:NSDateFormatterBehavior10_4 in Mavericks (OS X 10.9) #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run ServiceGenerator in Mavericks. Receive error message:
2013-10-30 18:20:15.967 ServiceGenerator[3321:507] 10.4-style NSDateFormatter 
method called on a 10.0-style formatter, which doesn't work. Break on 
_NSDateFormatter_Log_New_Methods_On_Old_Formatters to debug. This message will 
only be logged once.

What version of the product are you using? On what operating system?
Latest svn version; os x 10.9

Please provide any additional information below.
I have attached the solution required:
Index: Source/Tools/ServiceGenerator/FHGenerator.m
===================================================================
--- Source/Tools/ServiceGenerator/FHGenerator.m (revision 371)
+++ Source/Tools/ServiceGenerator/FHGenerator.m (working copy)
@@ -954,6 +954,7 @@
   NSLocale *enUSLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
   NSDateFormatter *formatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%Y"
                                                        allowNaturalLanguage:NO] autorelease];
+  [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
   [formatter setLocale:enUSLocale];
   NSString *yearStr = [formatter stringFromDate:[NSDate date]];

Index: Source/Tools/ServiceGenerator/FHMain.m
===================================================================
--- Source/Tools/ServiceGenerator/FHMain.m      (revision 371)
+++ Source/Tools/ServiceGenerator/FHMain.m      (working copy)
@@ -212,6 +212,7 @@
   NSDateFormatter *formatter =
     [[[NSDateFormatter alloc] initWithDateFormat:@"%Y"
                             allowNaturalLanguage:NO] autorelease];
+  [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
   [formatter setLocale:enUSLocale];
   NSString *yearStr = [formatter stringFromDate:[NSDate date]];

Original issue reported on code.google.com by amir.to...@gmail.com on 31 Oct 2013 at 1:34

GoogleCodeExporter commented 9 years ago
Thank you for reporting the issue. The library sources have been updated.

https://code.google.com/p/google-api-objectivec-client/source/detail?r=372
https://code.google.com/p/google-api-objectivec-client/source/detail?r=373

Original comment by grobb...@google.com on 31 Oct 2013 at 8:59