私はまったく起こらない非常に気まぐれなクラッシュに苦しんでいます。私はHockeyappを介してクラッシュレポートを受け取る、それはアプリが全くクラッシュしてはならないラインのクラッシュを報告し続ける。私はすでに1週間この問題に直面してきました。Swiftでクラッシュしない場所でのクラッシュライン( "if、let、where"ステートメント)
これは、コードの
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
行クラッシュレポートです:
if let booking = rescheduleBooking where booking.confirmed! == 0 {
existingRequests.append(booking)
}
ライン755は、if文です。 "if、let、where"ステートメントで、すぐに "let"がrescheduleBookingの存在をチェックします。存在し、割り当てられている場合、whereステートメントが実行されます。私のデバイスとシミュレータではローカルで、ヴァルスの値に関係なく、そこにはクラッシュしません...私は手で持っていない別のデバイスで起こっています...
何かアドバイス、または多分、私が正しく理解していない場合は、 "if、let where"の節、私はあなたの助けとコメントに非常に感謝します。
おかげ..
'let'を削除してみてください。 –
'booking.confirmed'が強制的にアンラップされているためにnilならばクラッシュします – Paulw11