Localization: application crashes when language is changed in simulator

淺唱寂寞╮ 提交于 2019-12-04 02:58:00

问题


In order to localize my application, I created Localizable.strings for three languages. I didn't need to localize any nib files since I'm not using any in my project. No images were localized, only the strings. In the code, I read the strings using NSLocalizedStrings(@"key", @"comment"). The Localized.strings files use UTF-16 format. The strings look like this: "Projects" = "Projekte";.

When I run the app in the simulator and change the language, my application that's running in the back crashes (SIGKILL). If I rerun the application, I can see that the language has been changed because the label of the Edit button is in German, but all my strings are still in English.

I read many threads about localization and I have three iOS books at home but I still don't know what I'm doing wrong.

Did I forget to set up something else? Any ideas?


回答1:


It's because when you change the language of your device, SpringBoard kills all the apps so that they will 'load' new language at the next startup. You can't change the system language without your app being killed. It has to be killed if you want to save your new language.

Your app doesn't crash. It's being killed (SIGKILL) by iOS.



来源:https://stackoverflow.com/questions/6626596/localization-application-crashes-when-language-is-changed-in-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!