I've developed an app in swift and UIKit. Its multi linguistic app supports English and Arabic. When I change the language from English to Arabic or Arabic to English. After changing language, when I navigate through different screens crash is happening randomly on different screens most of the time when I tap to navigate to a screen. And cash log is:
This time crashed with this error Exception NSException * "Not possible to remove variable:\t945: <unknown var (bug!) with engine as delegate:0x2824edf00>{id: 34210} colIndex:261 from engine <NSISEngine: 0x15c5dd5f0>{ delegate:0x15c594b50\nEngineVars:\n\t 0: objective{id: 31542} rowIndex:0\n\t 1: UIButton:0x15c6255b0.Width{id: 31545} rowIndex:1\n\t 2: 0x281c41450.marker{id: 31548} colIndex:1\n\t 3: UIButton:0x15c6255b0.Height{id: 31547} rowIndex:1073741824\n\t 4: 0x281c412c0.marker{id: 31546} colIndex:1073741825\n\t 5: UIButton:0x15c625a50.Width{id: 31549} rowIndex:11\n\t 6: 0x281c41270.marker{id: 31544} colIndex:2\n\t 7: UIButton:0x15c625a50.Height{id: 31551} rowIndex:1073741825\n\t 8: 0x281c414a0.marker{id: 31550} colIndex:1073741826\n\t 9: UILabel:0x15c625d10.Height{id: 31553} rowIndex:1073741826\n\t 10: 0x281c41590.marker{id: 31552} colIndex:1073741827\n\t 11: UIImageView:0x15c625870.Width{id: 31555} rowIndex:3\n\t 12: 0x281c41360.marker{id: 31554} colIndex:3\n\t 13: UIImageView:0x15c625870.Height{id: 31557} rowIndex:1073741827\n\t 14: 0x281c413b0.marker{id: 31556} colIndex:1073741828"... 0x0000000282fb11a0
For switching language I'm using this code snippet:
private func restartApp() {
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let delegate = windowScene.delegate as? SceneDelegate,
let window = delegate.window else {
return
}
// Create a new root view controller
let vc : AppLoadingVC = AppRouter.instantiateViewController(storyboard: .Splash)
let nc = UINavigationController(rootViewController: vc)
ApplicationManager.sharedInstance.isUserLoggedIn = false
DispatchQueue.main.async {
if UserDefaults.isRTL {
UIView.appearance().semanticContentAttribute = .forceRightToLeft
SideMenuController.preferences.basic.forceRightToLeft = true
Localize.setCurrentLanguage("ar")
} else {
UIView.appearance().semanticContentAttribute = .forceLeftToRight
SideMenuController.preferences.basic.forceRightToLeft = false
Localize.setCurrentLanguage("en")
}
window.rootViewController = nc
window.makeKeyAndVisible()
}
}
Please anybody help me I've been stuck here since lot of days. I tried multiple things but all in vain.