问题
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????
回答1:
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
回答2:
These are undocumented private API methods. Using them will get your app rejected by Apple. Use only the documented methods of NSDate.
来源:https://stackoverflow.com/questions/1163589/warning-no-method-descriptionwithcalendarformattimezonelocale-found