Xcode本地化让我疯了!没有加载Storyboard [英] Xcode Localization is driving me nuts! Not loading Storyboard

查看:846
本文介绍了Xcode本地化让我疯了!没有加载Storyboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题已经过去2天让我疯了。

It's been 2 days this issue is driving me nuts.

我正在尝试本地化我的iOS应用程序但是对于我的生活我无法得到它上班。当我尝试一个空白项目而不是我当前的项目时它很容易。

I'm trying to localize my iOS app but for the life of me I can't get it to work. It works easy enough when I try on a blank project but not on my current project.

我已经使用+在本地化中添加了语言,我已经本地化故事板,但当我检查模拟器或设备时,我仍然看到英文版。事实上,它甚至不是英文版,因为如果我更改Maintsoryboard(英文),我看不到设备中的更改...我仍然看到初始文本。

I've added the languages in the Localizations using "+", I've localized the storyboard but when I check on simulator or device I still see the english version. And in fact it's not even the English one because if I change the Maintsoryboard (english) I don't see the changes in the device ... I still see the initial texts.

我已经尝试重置模拟器,删除了应用程序等等。没有运气。

I've tried reseting the simulator, deleted the app, etc. No luck.

我已经恢复到备份尝试再次添加所有内容。没有运气。

I've reverted to a backup tried adding everything again. No luck.

有人可以帮忙吗?我知道继续下去并不多,但我不知道该解释什么来帮助你。所以如果我遗漏了一些信息,请告诉我。

Can someone please help? I know it's not much to go on, but I don't know what to explain to help you help me. So please let me know if I'm missing some info.

仅供参考,当我查看开发者中应用程序的文件夹时,我最初没有en.lproj什么时候我似乎应该默认一个?

FYI, when I look into the app's folder in Developer, I initially don't have a en.lproj when it seems I should have one by default?

推荐答案

看起来你已经想到了这一点,但我想可能发生了什么最初你有MainStoryboard.storyboard作为一个非本地化的资源。这意味着在构建应用程序时,会将MainStoryboard.storyboardc作为未本地化的资源。当您将故事板更改为本地化时,您的捆绑资源中会出现Base.lproj / MainStoryboard.storyboardc。

It looks like you already figured this out, but I think what probably happened is that originally you had "MainStoryboard.storyboard" as an unlocalized resource. This means that when you build your app, you get a "MainStoryboard.storyboardc" as an unlocalized resource. When you change your storyboard to be localized, you get a "Base.lproj/MainStoryboard.storyboardc" in your bundle resources.

当您使用应用程序时,有多个副本在Xcode中建立。您的设备或模拟器中有副本,Xcode中的派生数据文件夹中也有副本。当您对应用程序进行增量构建时,Xcode中派生数据文件夹中的副本是新内容和旧内容的合并。因此,当您在Xcode中修改资源并重建时,您将获得最新的资源。但是,当您重命名或删除资源时,旧副本仍保留在构建目录中,直到您执行清理操作。

There are several copies of your app when you're building in Xcode. There's the copy on your device or in the simulator, and there's also a copy in your derived data folder in Xcode. When you do an incremental build of your application, the copy in the derived data folder in Xcode is a merge of your new content and your old content. So, when you modify a resource in Xcode, and rebuild, you get the newest resource. However when you rename or delete resources, the old copy is still left in the build directory until you perform a clean operation.

这意味着您的构建产品可能同时具有 MainStoryboard.storyboardc和Base.lproj / MainStoryboard.storyboardc。当NSBundle加载资源时,它更喜欢未本地化的内容,并会加载旧的MainStoryboard.storyboardc。

This means that your build product probably had both "MainStoryboard.storyboardc" and "Base.lproj/MainStoryboard.storyboardc". When NSBundle loads resources, it prefers unlocalized content, and would load the old "MainStoryboard.storyboardc".

这篇关于Xcode本地化让我疯了!没有加载Storyboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆