views:

609

answers:

3

I am getting this warning in xcode 3.1.3 iphone os 3.0.

This method is also not available in the NSDate class. But I am getting the date from this method.

Can anyone please tell me How can I get rid of this warning????

A: 
I have the same question. Here is my code:

// Get the day number for todays date
dayNumber = [[NSDate date] descriptionWithCalendarFormat: paper.frontPageDayFormat timeZone: [NSTimeZone timeZoneWithAbbreviation:@"GMT"] locale: [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]] ;

and when I build I get:

warning: no '-descriptionWithCalendarFormat:timeZone:locale:' method found

Fin
A: 

These are undocumented private API methods. Using them will get your app rejected by Apple. Use only the documented methods of NSDate.

John Cromartie
A: 

You'll want to use NSDateFormatter instead. descriptionWithCalendarFormat:timeZone:locale: landed on the "non-public API" list recently, and is grounds for rejection of your app.

Here's an example of how you can use NSDateFormatter:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MMM d y"]; NSString *dateString = [dateFormatter stringFromDate:date]; return dateString;

Note that the format string is the Unicode standard, not the printf-style version. You can find the spec here: http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns

Art Taylor