Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted to modify the selection of an item in an out-of-bounds section (647) when there are only 647 sections. #1423

Open
zhhehj13 opened this issue Jan 3, 2024 · 3 comments

Comments

@zhhehj13
Copy link

zhhehj13 commented Jan 3, 2024

Attempted to modify the selection of an item in an out-of-bounds section (648) when there are only 648 sections. Collection view: <FSCalendarCollectionView: 0x10a04f200; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x282c844e0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x28228c8a0>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <FSCalendarCollectionViewLayout: 0x10914ad90>; dataSource: <FSCalendar: 0x109345d30; frame = (0 0; 0 0); layer = <CALayer: 0x2822845a0>>>.

cocoapods安装

  • 设备型号及版本。 例如: iPhone14 iOS17.1.2
  • 使用的Xcode版本。 Xcode15`
  • FSCalendar版本. FSCalendar 2.8.4
@Aaqibali279
Copy link

I am getting same issue in production app, below is stack trace
Screenshot 2024-03-29 at 12 27 05 PM

@Aaqibali279
Copy link

@WenchaoD can you please check this issue

@SergeyKovalenko
Copy link

FSCalendar has a working range of dates minimumDate - maximumDate, by defaults it's 1970-01-01 and 2099-12-31
I noticed strange behavior of minimumDate calculation for some time zones (e.g. America/Mazatlan (GMT-7))

NSDate *newMin = [self.dataSourceProxy minimumDateForCalendar:self]?:[self.formatter dateFromString:@"1970-01-01"];
newMin = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:newMin options:0];

here newMin will be 1970-01-01 01:00:00 however for any other date an hour component will be set to 0 hours
(e.g. 1970-01-02 00:00:00)
Because of this, calculations like - (NSIndexPath *)indexPathForDate:(NSDate *)date scope:(FSCalendarScope)scope are broken and leads to crash on iOS 17

There is a way to change minimumDate by implementing dataSource method to avoid such behavior

/**
 * Asks the dataSource the minimum date to display.
 */
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants