NSLocalizedStringFromTable无法在CocoaPod依赖项中工作

时间:2014-02-11 04:12:11

标签: cocoapods nslocalizedstring

我已将REActivityViewController安装为pod。这是pod中Resources文件夹的图片:

enter image description here

这是尝试拉弦的其中一条线:

    [_cancelButton setTitle:NSLocalizedStringFromTable(@"button.cancel", @"REActivityViewController", @"Cancel") forState:UIControlStateNormal];

按钮标题未本地化。在此示例中,它显示button.cancel。它不仅仅是这个按钮标题,还有这个依赖的所有按钮。


修改

所以在我Info下的主项目中就是这样。我无法点击它来查看那些文件。我的主项目中有NSLocalizedStrings,但我还没有创建.strings个文件:

enter image description here


修改

所以我检查了我的Pods-resources.sh,发现了这个:

 install_resource "REActivityViewController/REActivityViewController/REActivityViewController.bundle"
install_resource "REActivityViewController/REActivityViewController/Localizations/de.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/en.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/fr.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/it.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/ru.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/uk.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/zh-Hans.lproj"

1 个答案:

答案 0 :(得分:2)

好吧,我想出来了,看起来有些孤立。我查看了Target下的方框Run script only when installing - >复制Pods Resources,因为脚本速度很慢,所以安装bundle的脚本没有在调试时安装bundle。

enter image description here