UIDatePicker调用setDatePickerMode时的异常,其中Region Format设置为Taiwan Calendar to Japanese

时间:2011-05-08 20:47:02

标签: iphone objective-c ios4 uidatepicker

我们正在使用标准的UIDatePicker视图来允许用户使用选择器设置倒计时持续时间。代码如下:

//in the header file
UIDatePicker *pickerView;

//in the implementation file, the error is thrown when this line executes
[self.pickerView setDatePickerMode:UIDatePickerModeCountDownTimer];

这在大多数情况下都可以正常工作,但是我们的用户将其区域格式设置为台湾,将日历设置为日语。然后发生以下异常:

  

2011-05-08 21:38:13.701   AppName [6418:207] *断言   失败 - [UIDatePickerView   _updateRowInColumn:toValue:withRepeatingAmount:元件:动画:],   /SourceCache/UIKit_Sim/UIKit-1447.6.4/UIDatePicker.m:1499   2011-05-08 21:38:13.703   AppName [6418:207] 终止应用   由于未被捕获的例外   'NSInternalInconsistencyException',   理由:'哇!行太多了   栏:1'   * *第一次调用堆栈:(0 CoreFoundation
  0x00fa3be9 __exceptionPreprocess + 185     1 libobjc.A.dylib
  0x010f85c2 objc_exception_throw + 47     2 CoreFoundation
  0x00f5c628 + [NSException   raise:format:arguments:] + 136 3
  基金会
  0x000d447b - [NSAssertionHandler   handleFailureInMethod:对象:文件:LINENUMBER:描述:]   + 116 4 UIKit 0x004b1e4e - [UIDatePickerView   _updateRowInColumn:toValue:withRepeatingAmount:元件:动画:]   + 695 5 UIKit 0x004b5254 - [UIDatePickerView   _loadDateAnimated:] + 1012

有没有人对上述错误有任何经验或如何解决此问题?似乎这个组件的格里高利与非格里高利操作存在问题。根据我的理解,如果没有提供默认值,组件将采用用户的设置:

来自UIDatePicker.h:

@property(nonatomic,retain) NSLocale      *locale;                // default is nil. use current locale or locale from calendar
@property(nonatomic,retain) NSTimeZone    *timeZone;              // default is nil. use current time zone or time zone from calendar
@property(nonatomic,copy)   NSCalendar    *calendar;              // default is [NSCalendar currentCalendar]. setting nil returns to default

2 个答案:

答案 0 :(得分:0)

您是否为实例变量pickerView创建了一个属性?既然你没有在问题中提到它,我想知道你是如何访问pickerView的setter方法而不创建像@property这样的属性(nonatomic,retain)UIDatePicker * pickerView;

答案 1 :(得分:0)

这是以前的一个错误,现在已经通过iOS 5的发布解决了。