Hello,
First, thanks for the SR and the quick support so far, i'm still having issues with the fact asyncAppointmentRequest is not called in many of my cases. I'm trying to reproduce these issues in the samples project so I can send the code.
There are a few other things I wanted to point out, there will be more as soon as I got it reproduced in the samples browser:
Moderate: When I set the delegate to igCalendarAppointmentDatasourceProtocolAsync and add the dayChanged, weekChanged, monthChanged and yearChanged methods with logging I notice the weekChanged is being called many times while year and month (have not checked the day view yet)
2015-12-11 11:05:39.386 SamplesBrowser[346:38334] yearChanged
2015-12-11 11:05:41.905 SamplesBrowser[346:38334] monthChanged
2015-12-11 11:05:43.746 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.750 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.758 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.760 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.782 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.786 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.804 SamplesBrowser[346:38334] weekChanged
2015-12-11 11:05:43.811 SamplesBrowser[346:38334] weekChanged
Minor: When I start the Appt Datasource Async on an iPad with iOS 9.0.2 building with XCode 7.1.1 I get the following trace as soon as the calendar loads:
2015-12-11 10:44:16.806 SamplesBrowser[326:33845] *** -[__NSCFCalendar dateByAddingComponents:toDate:options:]: date cannot be nil
Future exception.
A few of these errors are going to be reported with this complaint, then further violations will simply be ignored.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
(
0 CoreFoundation 0x000000018632e7bc <redacted> + 252
1 CoreFoundation 0x000000018632e644 <redacted> + 96
2 SamplesBrowser 0x000000010018b034 __57-[igCalendarAppointmentDatasourceProtocolAsync loadAppts]_block_invoke + 1176
3 Foundation 0x000000018730f82c <redacted> + 16
4 Foundation 0x00000001872626c0 <redacted> + 96
5 Foundation 0x0000000187252918 <redacted> + 604
6 Foundation 0x0000000187311c20 <redacted> + 224
7 libdispatch.dylib 0x0000000100a89d30 _dispatch_client_callout + 16
8 libdispatch.dylib 0x0000000100a967f0 _dispatch_queue_drain + 1036
9 libdispatch.dylib 0x0000000100a8da20 _dispatch_queue_invoke + 464
10 libdispatch.dylib 0x0000000100a98908 _dispatch_root_queue_drain + 760
11 libdispatch.dylib 0x0000000100a98600 _dispatch_worker_thread3 + 132
12 libsystem_pthread.dylib 0x000000019b6c9478 _pthread_wqthread + 1092
13 libsystem_pthread.dylib 0x000000019b6c9028 start_wqthread + 4
)
Major issue: I am able to reproduce my issue not seeing appointments in the samples browser.
What I have done is added the code from igCalendarAppointmentDatasourceProtocolAsync to igCalendarNavigation so that I can have a good navigational test. All seemed okay and everything was visible but when I add the following line of code at the end of viewDidLoad the appointments are not displayed for that week (when I go to month and back to the same week I still get no appointments:
[_cal navigateToDate:[NSDate date] forType:IGCalendarViewDisplayTypeWeek];
The reason I add this line is that I want to have the calendar initially in week view on the iPad.
I added the class as an attachment :-)
Hey Daan,
Thanks for the sample.
The Calendar is actually working correctly. However, when the WeekView request the appointments, there aren't any appointments available yet.
Thats b/c in the sample, the appointments from the CSV are being loaded in a background thread.
So when the calendar asks for appointments for that specific point in time, there are no appointments available.
If you don't load the CSV in the background, then it works fine. Or you could call invalidate after the appointments are loaded and reloaded the calendar view.
Hope this helps,
-SteveZ
Thanks for the reply Steve,
Maybe i'm doing something wrong in the way I set it up in my project. We are using AFNetworking to retrieve the data from a web service. Let me summarize what i've done:
-(void)calendarView:(IGCalendarView *)calView asyncAppointmentRequest:(IGCalendarAppointmentRequest *)request ofType:(IGCalendarAppointmentRequestType)requestType
{
// Guess I can remove the following since the -001 bug has been fixed in the service release :-)
unsigned int flags = NSCalendarUnitYear | NSCalendarUnitMonth;
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDateComponents* components = [calendar components:flags fromDate:request.start];
if (components.year < 1970)
NSLog(@"Year is really low.");
return;
}
// I am keeping record of every month being retrieved at the web service so that I don't get the appointments more than once.
NSDate* strippedRequestDate = [calendar dateFromComponents:components];
bool monthExists;
for (NSDate * date in months)
if ([date timeIntervalSince1970] == [[strippedRequestDate toFirstDayOfMonth] timeIntervalSince1970])
monthExists = true;
// When the month exists, filter the list of appointments and return the requested ones
if (monthExists)
[[[NSOperationQueue alloc]init] addOperation:[NSBlockOperation blockOperationWithBlock:^(void)
NSLog(@"request.start %@", request.start);
NSLog(@"request.end %@", request.end);
NSTimeInterval min = [request.start timeIntervalSince1970];
NSTimeInterval max = [request.end timeIntervalSince1970];
NSMutableArray* returnAppts = [[NSMutableArray alloc]init];
for (IGCalendarAppointment* appt in _appts)
NSTimeInterval current = [appt.startTime timeIntervalSince1970];
if(current >= min && current <= max)
[returnAppts addObject:appt];
[[NSOperationQueue mainQueue] addOperation: [NSBlockOperation blockOperationWithBlock:^(void)
NSArray* appts = [NSArray arrayWithArray:returnAppts];
NSLog(@"APPOINTMENT COUNT: %lu", (unsigned long)appts.count);
// [request provideAppointments:appts];
}]];
else
// Custom method converting the date to first day of month and stripping hour, minute and second information
[months addObject:[strippedRequestDate toFirstDayOfMonth]];
// Following does the AFNetworking call to the web service, when it's done it provides the appointments so this is not exactly the same as the CSV example because the data is already retrieved.
PostParameters * params = [[PostParameters alloc] init];
[params.params setObject:[NSDate dateToServerStr:[strippedRequestDate toFirstDayOfMonth]] forKey:@"startdate"];
[params.params setObject:[NSDate dateToServerStr:[strippedRequestDate toLastDayOfMonth]] forKey:@"enddate"];
Networking * networking = [Networking networking];
[networking postRequest:params action:@"GetCalendarAppointments" success:^(NSString * xmlResponse) {
[_appts addObjectsFromArray:[[Context sharedContext].webservice getCalendarAppointments:xmlResponse]];
NSLog(@"request.start = %@", request.start);
NSLog(@"request.end = %@", request.end);
[request provideAppointments:appts];
NSLog(@"Success!");
} failure:^(NSError * error) {
NSLog(@"FAILED ACTION");
// If the web service fails, remove the added month from the months list so we can retrieve it again. Never got this message so this is not it.
[months removeObject:strippedRequestDate];
}];
I have found a fix but I don't think it's a nice one (calendar flickers a lot and horizontal scrolling through weeks is very buggy with this implemented)
Added a boolean forceRefresh to the class.
When monthExists is true in the code from my previous post I set the boolean to true right [request provideAppointments:appts]; with the following code:
if (appts.count == 0) forceRefresh = true;
When the month doesn't exist (the else statement in previous post) I add the following code right after the [request proviceAppointments:appts];
if (forceRefresh){ [_calendar invalidate]; forceRefresh = false;}
Well.. The data does show up this way and that is important for now.
Hope to hear from you if this is the solution to go with or if there are other ways of implementing a better solution.
Ok, so its definitely using the same build.
Maybe you can try using Sync callback with your simplified sample, and see if thats getting called 4 times?
2015-12-16 08:38:09.239 Gensys[28167:1603930] 2015.2.103
Perhaps the projects are using different versions of the IG Framework?
Can you insert the following line of code, in both the sample application, and in your actual app?
NSLog(@"%@", [IGBuildVersion buildVersion]);
I just want to make sure that your application isn't holding on to an older version.
I see the sample and everything working fine there. The only other difference I see is that you are using a storyboard where as we're using seperate xib files for the user interface.
I'm running out of ideas and without the CalendarView source code there is no way I can debug the issue. As you saw I stripped the entire code and do a simple call to the UIViewController. Nothing special just like in your sample.
Therefore I also checked the project settings and made some changes there. Also no result.
Thanks for the stripped down version.
I tried it out, and cleaned out all the commented code, but its still not happening for me.
I've attached the sample. Can you verify your'e seeing the same thing?