我尝试添加一个 Localizable.strings 文件并添加一些字符串进行测试,一切正常。
但是,当我尝试添加本地化时,事情开始变得奇怪。我可以添加本地化(英语和俄语),我可以在 finder 中看到文件列在两个文件夹中; ru.lproj 和 en.lproj。
清理和构建时出现以下编译错误:
Copy .strings file Error
The file "Localizable.strings" couldn't be opened because there is no such file.
最佳答案
通过从 tiguero 在评论中提供的此链接向正确的方向推送来修复它。
我进一步查看了 .pbxproj 文件,发现了这个奇怪的行,看起来很可疑:
6AAE55EC1551A42500C1F3F0 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
我将其移除、清理并重建。它现在被以下行取代:
6AC473DC1624BF3E00503305 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6AC473DE1624BF3E00503305 /* Localizable.strings */; };
而且有效!
关于objective-c - Localizable.strings 错误 - 编译器说文件丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12808044/