Jules
Jules

Reputation: 7766

Thread 1: "-[_UIDatePickerIOSCompactView setHighlightsToday:]: unrecognized selector sent to instance"

I'm getting crash reports from iOS 14, from using setHighlightsToday with the UIDatePicker.

Thread 1: "-[_UIDatePickerIOSCompactView setHighlightsToday:]: unrecognized selector sent to instance"

I can't see a fix for highlighting today?

I know I need to also check for the selector being available.

Upvotes: 2

Views: 1656

Answers (1)

Mohit Negi
Mohit Negi

Reputation: 91

You can try this.

 if #available(iOS 13.4, *) {
       datepicker.preferredDatePickerStyle = .wheels
       datepicker.setValue(false, forKeyPath: "highlightsToday")
  }

Upvotes: 8

Related Questions