gpt4 book ai didi

iphone - 在运行 iOS 时,以编程方式即时更改语言

转载 作者:IT王子 更新时间:2023-10-29 07:48:47 39 4
gpt4 key购买 nike

我已经堆放和谷歌搜索了几个小时。而我现在有点绝望。我想在应用程序内更改我的应用程序的语言,而不仅仅是使用默认语言。

根据我的尝试,我和每个人一样坚持重启步骤。意思是,苹果会强制您手动重启应用程序。这意味着您必须退出该应用程序,然后重新启动它。

好吧,在谷歌搜索之后,我试图设置一个闹钟,然后强制应用程序退出

exit(0);

糟糕,苹果似乎不喜欢这个并阻止开发人员使用它......我想我没有指向正确的方向。

最后,尽管遇到了所有问题,我还是可以见面讨论一下。

有什么提示吗?


编辑,来自 APPLE 的信息

In general, you should not change the iOS system language (via use of the AppleLanguages pref key) from within your application. This goes against the basic iOS user model for switching languages in the Settings app, and also uses a preference key that is not documented, meaning that at some point in the future, the key name could change, which would break your application.

If you want to switch languages in your application, you can do so via manually loading resource files in your bundle. You can use NSBundle:pathForResource:ofType:inDirectory:forLocalization: for this purpose, but keep in mind that your application would be responsible for all loading of localized data.

Regarding the exit(0) question, Apple DTS cannot comment on the app approval process. You should contact appreview@apple.com to get an answer for this question.

好吧,我必须选择到目前为止。

最佳答案

这是一个相当古老的问题,但我只是在努力解决同样的问题并找到了这个解决方案:

http://aggressive-mediocrity.blogspot.com/2010/03/custom-localization-system-for-your.html

这正是您所需要的(并且可能对遇到同样问题的其他人有帮助:)

关于iphone - 在运行 iOS 时,以编程方式即时更改语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5109245/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com