Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

anilkumar.parvatareddy

macrumors newbie
Original poster
Oct 30, 2017
1
0
Presently we are working with iOS11, facing issue with UIDatePicker in iOS 10 everything is working fine.

Below is my code this code working in Simulator in iOS 11, coming to device its getting crashing With NSRangeException like

[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 1]






let arabicDatePicker = UIDatePicker()

let islamicCalendar = Calendar.init(identifier: Calendar.Identifier.islamic)

arabicDatePicker.calendar = islamicCalendar

arabicDatePicker.datePickerMode = UIDatePickerMode.date

arabicDatePicker.maximumDate = Date()


Please do needful ASAP.
 

bjet767

Suspended
Oct 2, 2010
967
320
I don’t code in Swift, but the error you are getting is an object is calling an object from an array that isn’t there.

Typically the way to debug this is to step through each line of code until you get the one which throws the error message. My guess is your last one, “= Date(),” is causing the error.

Date() I believe will assign the maximum date of the picker to today. That seems a bit silly doesn’t it?

If you need the maximum date to be the day your user starts the app then I might set it to present date + 12 hours.

You also know you can leave the max and mins of the picker unassigned? You might try that and see if you come up with the same error.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.