NSDate problem with retrieving events from calendar
<p>I am receiving two values from NSDatePicker (startDate, endDate).  After that I try to retrieve Calendar Events  between these two dates.  Instead of startDate, endDate I give distantPast, distantFuture.</p>

<p>The program not showing any error.  When using this code I got EXC_BAD_ACCESS.  What's wrong with this code?</p>

<pre><code>NSCalendar *sysCalendar = [[NSCalendar currentCalendar] autorelease];
unsigned int unitFlags = NSDayCalendarUnit; 
NSDateComponents *difference=[[[NSDateComponents alloc] init] autorelease];
difference = [[sysCalendar components:unitFlags fromDate:startDate 
                             toDate:endDate options:0] autorelease]; 
double days = [difference day]; 
NSLog(@"DAYSS   %@",days);
</code></pre>
