0

アプリ ストアでアプリを入手しましたが、再現できないクラッシュが発生しているユーザーがいます。私にとっては問題なく動作します。クラッシュは、次のコード行によって発生します。

timePicker.date = editingEvent.time;

ここで、timePicker は UIDatePicker、editingEvent はカスタム オブジェクト、time は NSDate プロパティです。バックトレースは次のとおりです。

最後の例外バックトレース: 0 CoreFoundation
0x3785029e __exceptionPreprocess + 158 1 libobjc.A.dylib
0x3535097a objc_exception_throw + 26 2 CoreFoundation
0x37850158 +[NSException raise:format:arguments:] + 96 3 Foundation 0x398e62aa -objectNSAssertionNumber:handle:descriptionFailureInメソッド: :] + 86 4
UIKit 0x3736be20 -[_UIDatePickerView _setDate:animated:forced:] + 144 5 UIKit 0x373742d4 -[_UIDatePickerView setDate:animated:] + 28 6 UIKit
0x3743d464 -[UIDatePicker setDate:] + 32

任意のアイデア - 私が見落としているもの/何が間違っている可能性がありますか? バグの可能性がある場所を見つけるには、ここからどのように進めればよいでしょうか?

4

1 に答える 1

1

こうやって、

NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"hh:mm a"];
NSString *formattedDateString = [dateFormatter stringFromDate:editingEvent.time];

NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
[timeFormatter setDateFormat:@"hh:mm a"];
NSDate *timeFromString = [[NSDate alloc] init];
timeFromString = [timeFormatter dateFromString:formattedDateString];
timePicker.date=timeFromString;
于 2012-12-10T04:47:59.687 に答える