warning no-method descriptionWithCalendarFormat:timeZone:找到的语言环境

1 xcode nsdate iphone-sdk-3.0

我在xcode 3.1.3 iphone os 3.0中收到此警告.

此方法在NSDate类中也不可用.但我从这个方法得到日期.

谁能告诉我怎样才能摆脱这个警告????

Art*_*lor 8

您将要使用NSDateFormatter.descriptionWithCalendarFormat:timeZone:locale:最近登陆"非公开API"列表,是拒绝您的应用程序的理由.

以下是如何使用NSDateFormatter的示例:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMM d y"];
NSString *dateString = [dateFormatter stringFromDate:date];
return dateString;
Run Code Online (Sandbox Code Playgroud)

请注意,格式字符串是Unicode标准,而不是printf样式的版本.你可以在这里找到规范:http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns