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

Only iOS 17 Crash - JTACMonthLayout - setupDataFromDelegate #1385

Open
HalitGumus opened this issue Oct 2, 2023 · 11 comments
Open

Only iOS 17 Crash - JTACMonthLayout - setupDataFromDelegate #1385

HalitGumus opened this issue Oct 2, 2023 · 11 comments

Comments

@HalitGumus
Copy link

HalitGumus commented Oct 2, 2023

Hi,
First of all, I am using the latest version of JTAppleCalendar (8.0.2).It was crashing in the previous (8.0.1) version

Description

Only iOS 17 users experience the error in the screenshot below. It doesn't always crash, it crashes every 2-3 attempts.

Screenshot 2023-10-02 at 12 51 43 PM

Firebase Crashlytics

Crashed: com.apple.main-thread
0 JTAppleCalendar 0x26ba8 $s15JTAppleCalendar15JTACMonthLayoutC21setupDataFromDelegateyyF + 1020
1 JTAppleCalendar 0x265fc $s15JTAppleCalendar15JTACMonthLayoutC7prepareyyF + 396
2 JTAppleCalendar 0x2679c $s15JTAppleCalendar15JTACMonthLayoutC7prepareyyFTo + 28
3 UIKitCore 0x1309d4 -[UICollectionViewData _prepareToLoadData] + 100
4 UIKitCore 0x12db5c -[UICollectionViewData validateLayoutInRect:] + 100
5 UIKitCore 0x7a84c -[UICollectionView layoutSubviews] + 220
6 JTAppleCalendar 0x22584 $s15JTAppleCalendar13JTACMonthViewC14layoutSubviewsyyF + 48
7 JTAppleCalendar 0x22698 $s15JTAppleCalendar13JTACMonthViewC14layoutSubviewsyyFTo + 28
8 UIKitCore 0x331d8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1528
9 QuartzCore 0x67888 CA::Layer::layout_if_needed(CA::Transaction*) + 500
10 QuartzCore 0x67410 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 144
11 QuartzCore 0x6d94c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464
12 QuartzCore 0x66c3c CA::Transaction::commit() + 648
13 QuartzCore 0x668e4 CA::Transaction::flush_as_runloop_observer(bool) + 88
14 CoreFoundation 0x361dc CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 36
15 CoreFoundation 0x34be4 __CFRunLoopDoObservers + 548
16 CoreFoundation 0x34300 __CFRunLoopRun + 1028
17 CoreFoundation 0x33e18 CFRunLoopRunSpecific + 608
18 GraphicsServices 0x35ec GSEventRunModal + 164
19 UIKitCore 0x22f350 -[UIApplication _run] + 888
20 UIKitCore 0x22e98c UIApplicationMain + 340
21 Appname 0x7118 main + 21 (AppDelegate.swift:21)
22 ??? 0x1d03e3d44 (Missing)
Screenshot 2023-10-02 at 1 01 59 PM

@patchthecode
Copy link
Owner

the latest version is 8.0.5
maybe that might be reason why?

@patchthecode
Copy link
Owner

I will update the New issue version to 8.0.5 so this confusion wont happen again

@HalitGumus
Copy link
Author

When I check again, I was already using version 8.0.5. There is a bug in this version

@ranjeetpisal
Copy link

we have checked again
I am on version 8.0.5. still issue is there

@imdbest25
Copy link

I am also facing same issue with version 8.0.5 version of library installed. And apple is not going to accept my build for further release until the issue is fixed. Please comment any solution if you have

@HalitGumus
Copy link
Author

This crash seems to occur when the start and end dates are the same.

func configureCalendar(_ calendar: JTACMonthView) -> ConfigurationParameters {
        
        guard let startDate = self.startDate, let endDate = self.endDate else {
            return ConfigurationParameters(startDate: Date(), endDate: Date(), numberOfRows: 5, generateOutDates: .tillEndOfRow, firstDayOfWeek: .monday)
            
        }
        return ConfigurationParameters(startDate: startDate, endDate: endDate, numberOfRows: 5, generateOutDates: .tillEndOfRow, firstDayOfWeek: .monday)
    }
    
endDate: Date()

When I changed this code as follows, the problem was solved for me.

endDate: Date().addingTimeInterval(1)

@patchthecode
Copy link
Owner

patchthecode commented Oct 3, 2023

@HalitGumus thank you!!
If this is the issue, then the fix is extremely simple.

I'll respond back here in a bit

@patchthecode
Copy link
Owner

@HalitGumus i made a code change to master branch.
If you are using Swift Package manager, set it to use master branch instead of 8.0.5 and let me know if the issue persists.

@imdbest25
Copy link

Thank you @HalitGumus @patchthecode for quick responses.
The solution worked for me.

@HalitGumus
Copy link
Author

@patchthecode I am using pod, and when I updated it with the relevant commit as below, the same crash occurred. I'll try again when the version(8.0.6) comes out.

pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar', :commit => 'abf4cfccc62ef75a070d0dded0fd823d5a86f72a'

@patchthecode
Copy link
Owner

@HalitGumus it seems like youre getting crashes consistently which is good.

Any chance you can prove a dry basic app with the crash (remove all company code)
The only code that's necessary is the setting up of the calendar etc. You dont even have to design the cells, just create a clean app with the setup.

The reason why I'm asking is because there are many parts it can fail.
example

  1. How is it setup in code? What does the code there look like? Or, is it on a Nib? or is it on a Story board? whats the settings there?
  2. Are you loading anything on viewDidLoad?
  3. Are loading up dates etc for multi-selection ?
    etc
    etc
    etc

Many failure points.
That last commit should have stopped the crash. I also added an Assert in there as a safety. The assert crashes in development mode and gives you a message on whats wrong. But if its still crashing, then I will need some sort of code to recreate this. Everything is working fine on my sample app attached to this github repository.

Also i'm available all day today on discord chat app. So let me me know if you can link up.

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

4 participants