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

Fatal error: Can't form Range with upperBound < lowerBound #19

Closed
mhmmdmz opened this issue Dec 5, 2020 · 3 comments
Closed

Fatal error: Can't form Range with upperBound < lowerBound #19

mhmmdmz opened this issue Dec 5, 2020 · 3 comments

Comments

@mhmmdmz
Copy link

mhmmdmz commented Dec 5, 2020

When running my app on smaller screens (iPod, iPhone SE, etc.) the pod crashes in TimelineTableViewCell.swift at line 101 with the fatal error:

Thread 1: Fatal error: Can't form Range with upperBound < lowerBound file Swift/x86_64-apple-ios-simulator.swiftinterface, line 14814

This is the code starting from line 101.

let views = viewsInStackView.count <= maxNumSubviews ? viewsInStackView : Array(viewsInStackView[0..<maxNumSubviews]) views.forEach { view in view.translatesAutoresizingMaskIntoConstraints = false view.addConstraint(NSLayoutConstraint(item: view, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: view, attribute: NSLayoutConstraint.Attribute.height, multiplier: 1, constant: 0)) view.contentMode = .scaleAspectFill view.clipsToBounds = true stackView.addArrangedSubview(view) }

viewsInStackView at this stage are 0, while the maxNumSubviews are -1. Hence the crash.

This is only seen on some devices, not all. Hence it is difficult to spot or reproduce. I have seen this on some iPhone 5s, iPhone SE and iPod Touch (7th Gen) so far.

Need a resolution really soon as many of my users can't use my app anymore.

@kf99916
Copy link
Owner

kf99916 commented Dec 9, 2020

Please try the possible fix at the master branch: 56dddbb
Let me know if you have any updates.

@mhmmdmz
Copy link
Author

mhmmdmz commented Dec 14, 2020

Thanks. This works. I can't be 100% sure because I personally can't reproduce the error all the time - I was able to only reproduce it on an iPod touch simulator and it seems to have fixed the issue. Once you update the Master, I'll update my app and keep you posted - unless, you have a way I could reproduce the error?

@kf99916
Copy link
Owner

kf99916 commented Dec 14, 2020

@mhmmdmz, thank you for your information. The issue will be closed first and the new version will be released. Let me know if it is not still fixed.

@kf99916 kf99916 closed this as completed Dec 14, 2020
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

2 participants