JTAppleCalendar icon indicating copy to clipboard operation
JTAppleCalendar copied to clipboard

Application got crashed at JTACMonthLayout due to nil value

Open NIRANJANPRASAD opened this issue 2 years ago • 11 comments

(Required) Version Number: 8.0.3

Description

trictBoundaryRulesShouldApply = thereAreHeaders || delegate._cachedConfiguration.hasStrictBoundaries line 168 Thread 1: Swift runtime failure: Unexpectedly found nil while implicitly unwrapping an Optional value

Steps To Reproduce

Expected Behavior

Additional Context

NIRANJANPRASAD avatar Jul 17 '23 06:07 NIRANJANPRASAD

can you produce a sample app with the issue please?

patchthecode avatar Jul 17 '23 13:07 patchthecode

Screenshot 2023-08-08 at 12 21 35 PM

I tried using pods and package dependancies, still getting crash here

Swathiga-proj avatar Aug 08 '23 06:08 Swathiga-proj

can you produce a sample app with the issue please?

patchthecode avatar Aug 09 '23 13:08 patchthecode

I am having a similar Issue with a crash in JTACMonthLayout.swift+168. The problem is only present on iOS 17 and the app always crashes in the first few seconds of execution suggesting an issue while loading the view, where the cachedConfiguration has not been set, but the view is already being laid out.

So far I have not been able to reproduce the crash nor produce a sample app with the issue, but it affects roughly 25% of my app's users on iOS 17, so this is not just a rare edge case.

Maybe this additional context as to when the crash occurs can help you diagnose the issue. I will continue to look for ways to fix this and keep you posted on any progress.

timfraedrich avatar Sep 21 '23 14:09 timfraedrich

Ok, it help a bit, but do you have any crash logs at all? Or is it crashing in the same location as the image above? Also can you confirm what version you are using?

8.0.5 has a fix for that very crash

patchthecode avatar Sep 21 '23 18:09 patchthecode

We have been using 8.0.5 for a while now, the issue only came up with iOS 17. You can find a crash log here. Yes, as mentioned above it crashes in JTACMonthLayout.swift on Line 168.

timfraedrich avatar Sep 21 '23 18:09 timfraedrich

im just updating to the latest xcode today. give some time to investigate

patchthecode avatar Sep 22 '23 14:09 patchthecode

@timfraedrich possible. In your app, is it possible that your start date is greater than your end date?

@Swathiga-proj
you were able to see the crash in development mode, can you please provide a sample app? I just updated to latest iOS my mine is running fine

@NIRANJANPRASAD if you are able to provide a smple app this will help

patchthecode avatar Sep 23 '23 13:09 patchthecode

@timfraedrich

i still need some sort of sample code. I need to know how you are setting up the delegate, setting up the configs etc. I cant tell anything more seeing some code/sample app.

These things are important:

  1. are you setting things up in code?
  2. are you using storyboard?
  3. is it a mixture of both? and if so, how is the delegate setup?

etc etc

If you make a bare minimum sample app that closely resembles your real app i can know. forget about designing it, just a base app will do. If you are unable to do this, then we'll have to spend time here with many questions (since i am unable to reproduce it)

Since its happening for some of your users (on ios 17) and not all on ios 17, then I am interested to see what setup you have.

patchthecode avatar Sep 23 '23 13:09 patchthecode

@timfraedrich Ok i had some time to debug your issue.

You are experiencing this crash because you data source is not set by the time by the time the following code is run:

strictBoundaryRulesShouldApply = thereAreHeaders || delegate._cachedConfiguration.hasStrictBoundaries

Your data source should have been set before that code is hit. Can you tell me how/where you are setting your dataSource?

But regardless, you code should not crash, therefore I have updated the code base to make the code safer.

fix done here 6b1f96b

patchthecode avatar Sep 30 '23 15:09 patchthecode

Also, adding to the confusion,

The errors mentioned here on this issue are 2 separate errors. @Swathiga-proj you issue is due to you not correctly setting up the delegates and data source. while @timfraedrich Your issue should be resolved in the latest fix to master branch

patchthecode avatar Sep 30 '23 15:09 patchthecode