LocalizedStringFromTable在CocoaPo

LocalizedStringFromTable在CocoaPo

本文介绍了NSLocalizedStringFromTable在CocoaPod依赖项中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 REActivityViewController 作为广告连播。以下是广告连播中资源文件夹的图片:

I've installed REActivityViewController as a pod. Here's the picture of the Resourcesfolder in the pod:

这是尝试拉线的线之一:

And here's one of the lines trying to pull the strings:

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

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

The button titles come out not-localized. In this example it shows button.cancel. It's also not just this button title but all the buttons in this dependancy.

EDIT

所以在我的主项目中的信息下有这个。我无法单击它来查看它们是什么文件。我的主项目中有 NSLocalizedStrings ,但尚未创建 .strings 文件:

So in my Main Project under Info there's this. I can't click it to see what files those are. I have NSLocalizedStrings in my main project but I have yet to create a .strings files out of them:

编辑

所以我检查了 Pods-resources.sh 并找到以下内容:

So I checked my Pods-resources.sh and found this:

 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"


推荐答案

好的,我发现了这一点,看起来有点孤立。我已经在目标->复制Pods资源下选中了仅在安装时运行脚本框,因为该脚本的运行速度非常慢,因此安装捆绑包的脚本未安装

OK, I figured this out and it looks like it was somewhat isolated. I had checked the box Run script only when installing under Target -> Copy Pods Resources, because the script were painfully slow, so the script to install the bundle wasn't installing the bundle while debugging.

这篇关于NSLocalizedStringFromTable在CocoaPod依赖项中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 05:17