I've been struggling with a very weird crash that should not happen at all. I receive the crash report via Hockeyapp, it keeps reporting a crash in a line that the app should not crash at all. I've been facing this problem for already 1 week.
This is the crash report
0 TeacherBox 0x00000001000864f0 TeacherBox.RequestLessonViewController.loadExistingRequests () -> () (RequestLessonViewController.swift:755)
1 TeacherBox 0x0000000100086514 @objc TeacherBox.RequestLessonViewController.loadExistingRequests () -> () (RequestLessonViewController.swift:0)
2 TeacherBox 0x0000000100086a84 function signature specialization <Arg[0] = Dead> of TeacherBox.RequestLessonViewController.viewDidAppear (Swift.Bool) -> () (RequestLessonViewController.swift:122)
3 TeacherBox 0x000000010007e570 @objc TeacherBox.RequestLessonViewController.viewDidAppear (Swift.Bool) -> () (RequestLessonViewController.swift:0)
4 UIKit 0x00000001895b84dc -[UIViewController _setViewAppearState:isAnimating:] + 844
5 UIKit 0x00000001895b8a40 -[UIViewController _endAppearanceTransition:] + 216
6 UIKit 0x0000000189671038 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 1232
7 UIKit 0x0000000189742198 __49-[UINavigationController _startCustomTransition:]_block_invoke + 228
8 UIKit 0x00000001896c7cc4 -[_UIViewControllerTransitionContext completeTransition:] + 112
9 UIKit 0x00000001898181ec __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke.97 + 708
10 UIKit 0x00000001895d9214 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 488
11 UIKit 0x00000001895d8d38 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 308
12 UIKit 0x00000001895d8b78 -[UIViewAnimationState animationDidStop:finished:] + 156
Lines of code:
if let booking = rescheduleBooking where booking.confirmed! == 0 {
existingRequests.append(booking)
}
The line 755 is the if statement. In a "if, let, where" statement in swift, "let" checks for the existence of rescheduleBooking, if it exists and is assigned, the where statements is executed.... Am I right?... Anyway, I tested locally in my device and simulator and it doesn't crash there, no matter the values of the vars... it is happening in a different device that I don't have on hands..
Please, if you have any advice, or maybe, if I didn't understand correctly the "if, let where" clause, I will be very grateful of your help and comments.
Thanks..