Hi,
Steps to reproduce crash on calendar view.
- Change appointment duration as more than one day (for e.g in appts.csv file, last column change it to 3000)
- Run app & then click on date in month view for that multiple appointment , app is crashing.
Please find below partial crash log,
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 96 beyond bounds [0 .. 95]'
*** First throw call stack:
(
0 CoreFoundation 0x0332e5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02c258b6 objc_exception_throw + 44
2 CoreFoundation 0x032cf556 -[__NSArrayM objectAtIndex:] + 246
3 CoreFoundation 0x033ad608 -[NSArray objectAtIndexedSubscript:] + 40
4 SamplesBrowser 0x001f02ae -[DayViewArea updateLayout] + 1149
5 SamplesBrowser 0x001f205e -[DayViewArea setDay:withAppointments:force:] + 288
6 SamplesBrowser 0x001f5535 -[MultiDayViewArea render:] + 1120
7 SamplesBrowser 0x001f4116 -[MultiDayViewArea request:appointmentsProvided:] + 722
8 SamplesBrowser 0x002060a5 -[IGCalendarAppointmentRequest provideAppointments:] + 102
9 SamplesBrowser 0x0011d35a __92-[igCalendarAppointmentDatasourceProtocolAsync calendarView:asyncAppointmentRequest:ofType:]_block_invoke_2 + 122
10 Foundation 0x02467b85 -[NSBlockOperation main] + 88
11 Foundation 0x024c0a69 -[__NSOperationInternal _start:] + 671
I couldn't reproduce the error, although i think it was a problem originally in the SamplesBrowser. Basically we weren't building the dates properly. Below you can find the latest version of the method we're using to load the CSV:
-(void)loadAppts
{
[[[NSOperationQueue alloc]init] addOperation:[NSBlockOperation blockOperationWithBlock:^(void)
NSString* filepath = [[NSBundle mainBundle] pathForResource:@"appts" ofType:@"csv"];
NSError *err;
NSString *dataRaw = [NSString stringWithContentsOfFile:filepath encoding:NSASCIIStringEncoding error:&err];
NSArray *linesArray = [dataRaw componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@",\r"]];
NSMutableArray* appts = [[NSMutableArray alloc]init];
for(int i = 0; i < linesArray.count; i+=4)
NSMutableDictionary* appt = [[NSMutableDictionary alloc]init];
appt[@"location"] = linesArray[i + 1];
appt[@"title"] = linesArray[i + 2];
NSString* dateString = linesArray[i];
float duration = ((NSString*)linesArray[i + 3]).floatValue;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"MM.dd.yy HH:mm"];
NSDate* date;
[df getObjectValue:&date forString:dateString range:nil error:nil];
NSDateComponents* comps = [[NSDateComponents alloc]init];
comps.minute = duration;
NSCalendar* cal = [NSCalendar currentCalendar];
NSDate* endDate = [cal dateByAddingComponents:comps toDate:date options:0];
appt[@"start"] = date;
appt[@"end"]= endDate;
[appts addObject:appt];
}
[[NSOperationQueue mainQueue] addOperation: [NSBlockOperation blockOperationWithBlock:^(void)
_appts = [NSArray arrayWithArray:appts];
}]];
-SteveZ
Still getting crash on selection of date.
Hi Steve,
I have integrated your suggestion in sample app. App still crashing on selecting date of multi date appointment.
Crash is as below,
0 CoreFoundation 0x032935e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02b8a8b6 objc_exception_throw + 44
2 CoreFoundation 0x03234556 -[__NSArrayM objectAtIndex:] + 246
3 CoreFoundation 0x03312608 -[NSArray objectAtIndexedSubscript:] + 40
4 SamplesBrowser 0x0015e69e -[DayViewArea updateLayout] + 1149
5 SamplesBrowser 0x0016044e -[DayViewArea setDay:withAppointments:force:] + 288
6 SamplesBrowser 0x00163925 -[MultiDayViewArea render:] + 1120
7 SamplesBrowser 0x00162506 -[MultiDayViewArea request:appointmentsProvided:] + 722
8 SamplesBrowser 0x00174495 -[IGCalendarAppointmentRequest provideAppointments:] + 102
9 SamplesBrowser 0x000a944b __92-[igCalendarAppointmentDatasourceProtocolAsync calendarView:asyncAppointmentRequest:ofType:]_block_invoke_2 + 84
10 Foundation 0x023ccb85 -[NSBlockOperation main] + 88
11 Foundation 0x02425a69 -[__NSOperationInternal _start:] + 671
12 Foundation 0x023a2798 -[NSOperation start] + 83
13 Foundation 0x02427d34 __NSOQSchedule_f + 62
14 libdispatch.dylib 0x041f74b0 _dispatch_client_callout + 14
15 libdispatch.dylib 0x041e5766 _dispatch_main_queue_callback_4CF + 340
16 CoreFoundation 0x032f8a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
17 CoreFoundation 0x0323972b __CFRunLoopRun + 1963
18 CoreFoundation 0x03238b33 CFRunLoopRunSpecific + 467
19 CoreFoundation 0x0323894b CFRunLoopRunInMode + 123
20 GraphicsServices 0x035209d7 GSEventRunModal + 192
21 GraphicsServices 0x035207fe GSEventRun + 104
22 UIKit 0x014c394b UIApplicationMain + 1225
23 SamplesBrowser 0x0000ab11 main + 94
24 libdyld.dylib 0x04487725 start + 0
25 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Hi Ameer,
I noticed this stack trace is within the samples browser.
Is it crashing when you run the app i attached?
I tested attached code. For single multi day entry it is working fine but,
if there are more than one entries which have multiple days appointment then it is crashing on click of date.
Updated appts.csv files first two entries as below
03.13.14 06:06,Villers-aux-Tours,rutrum lorem,3000
03.14.14 03:10,Watermaal-Bosvoorde,fringilla euismod,7338
If appointments are not overlapping each other then first multi day appointment DAY click works fine & crashes on second entry of multi day appointment.
Regards
Ameer
Thanks for your patience Ameer,
I was able to reproduce the issue now, and have identified a bug within the DayView.
I already have a fix in place for it, our Support team will notify you of the bug number so that you'll be notified when the next SR is realeasd.
Thanks again
Steve,
I'm also encountering the same error in production and need this fix ASAP. Would you mind adding me to the release notification so that I can get this patch in? Also, do you have any estimate on the timeline for the next release?
Thank you for your help!
-Brandon
Hello,
This has been addressed in the latest service release. To download the service release, log in to ‘Account’ and select ‘Keys & Downloads’. Select the appropriate tab for this product; then the license key. The available service releases (Hot Fixes) should now be listed on the page. Let me know if you have any questions regarding this matter.
Let us know if you have any questions regarding this matter.
Michael,
I'm using the Xamarin version of the controls. Will these be updated at the same time, or will it be a separate release?
Thanks!
Hello Brandon,
I have opened a private case for you as well so this way you will be notified automatically when the development issue is updated. The case number is CAS-134176-Q0S7N6. You will see it located here: https://ko.infragistics.com/my-account/support-activity
Let me know if you have any questions regarding this matter.