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

Setting row number to 1 causes to crash when selecting item from calendar #107

Closed
ukmarn opened this issue Aug 10, 2016 · 6 comments
Closed

Comments

@ukmarn
Copy link

ukmarn commented Aug 10, 2016

First of all thanks for this awesome library.

I am using it to create some kind of weekly calendar. As I change rows to 1, it works fine when scrolling but as soon as I select an item from calendar, it crashes.

Code:

numberOfRows = 1
self.calendarView.reloadData()
// After reloading. Scroll to your selected date, and setup your calendar
self.calendarView.scrollToDate(NSDate(), triggerScrollToDateDelegate: false, animateScroll: false) {
}

The error log:

*** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UICollectionView.m:4422
2016-08-10 13:11:46.320 CalApp[23298:3801720] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete item 9 from section 46 which only contains 7 items before the update'

Xcode marks error row as: JTAppleCalendarView, batchReloadIndexPaths's completition (line 724)

Is it wrong something I am doing or is it library thing? Thanks for help

@patchthecode patchthecode self-assigned this Aug 10, 2016
@patchthecode
Copy link
Owner

its a bug.
looking into it.

patchthecode added a commit that referenced this issue Aug 10, 2016
#107

On layout change, selected view were not properly being reselected in the new layout. Bad code. Caused crash.
@patchthecode
Copy link
Owner

patchthecode commented Aug 10, 2016

Fixed on master branch. If youre using this project with cocoapods, you can test master branch with the instructions here.

@ukmarn
Copy link
Author

ukmarn commented Aug 11, 2016

Thanks a lot!

@ukmarn ukmarn closed this as completed Aug 11, 2016
@ukmarn ukmarn reopened this Aug 11, 2016
@ukmarn
Copy link
Author

ukmarn commented Aug 11, 2016

@patchthecode I tried again and bug still exists. I have user instructions you provided. Also when scrolling through days (when calendar has only one row), days get skipped - current month is showing fine, september skips when scrolling to next week from 11 to 29.

@patchthecode
Copy link
Owner

crash bug still exists. looking into it.

patchthecode added a commit that referenced this issue Aug 12, 2016
#107

App crashed because of incorrect counterpart date calculation when entire row contained boundary dates
@patchthecode
Copy link
Owner

Fixed on master branch.

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

No branches or pull requests

2 participants