MoathOthman / MOLH

Localization helper for iOS apps mainly focusing on the LTR/RTL issue
MIT License
117 stars 36 forks source link

App Crash Randomly #73

Open abdallahnh opened 1 year ago

abdallahnh commented 1 year ago

crash summary: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Not possible to remove variable:

After searching for a solution i found this thread: https://developer.apple.com/forums/thread/674689

Did anyone face this crash?

in the thread they mentioned

I had a similar issue, resolved it just yesterday. the solution to it was to remove the following call to UIView.appearance().semanticContentAttribute = isRTL ? .forceRightToLeft : .forceLeftToRight

/ where isRTL is a global computed variable that gets the UI direction of the current Locale that I set when the user changes the language. / whenever the ui language is changed by the user, and to enforce using the correct layout direction I was Swizzling the UIApplication.userInterfaceLayoutDirection to return the proper UI direction according to the selected language. Note: I had a crash just once in over 100 tests, where the other +99 tests the issue was a delay in viewing an already created ViewController vc either by otherVC.present(vc) it, nav.push(vc) it, nav.set([vc]), or nav.pop to vc, meaning if the that vc is just created will not cause any delay but if it was already created and presented before, there will be a delay between viewWillAppear and viewDidAppear for ~200mSec x n times UI direction changes 200mSec is relative to the UI complexity of vc.

MoathOthman commented 1 year ago

@abdallahnh i don;t recall facing it, could u reproduce it?

abdallahnh commented 1 year ago

it is hard to reproduce

MoathOthman commented 1 year ago

@abdallahnh i know its late but we had similar crash recently , and it was because of missed up autolayout, so basically resolving the autolayout issues/warning should do it.