我正在创建字符串扩展名
@objc extension String {
static func className(_ aClass: AnyClass) -> String {
return NSStringFromClass(aClass).components(separatedBy: ".").last!
}
func localize() -> String
{
return NSLocalizedString(self, comment: "")
}}
Run Code Online (Sandbox Code Playgroud)
我在 swift 中使用这个
btnReferencePhoto.setTitle("ADD REFERENCE PHOTO".localize(), for: .normal)
Run Code Online (Sandbox Code Playgroud)
我想在目标 c 中使用它,但我能够访问目标 c 文件中的本地化方法,因为我在字符串扩展名中添加了 @objc,但它给出了错误
我也试过
我在使用运行我的项目时遇到错误react-native run-ios
错误 React Native CLI 对本机依赖项使用自动链接,但以下模块是手动链接的:
- react-native-document-picker (要取消链接,请运行:“react-native unlink react-native-document-picker”)
- react-native-fast-image(要取消链接,请运行:“react-native unlink react-native-fast-image”)
- react-native-image-picker (要取消链接,请运行:“react-native unlink react-native-image-picker”)
- react-native-maps(要取消链接,请运行:“react-native unlink react-native-maps”)
- react-native-navigation (要取消链接,请运行:“react-native unlink react-native-navigation”)
- react-native-permissions (要取消链接,请运行:“react-native unlink react-native-permissions”)
- React-Native-Vector-icons(要取消链接,请运行:“React-Native Unlink React-Native-Vector-icons”)
当 React Native 从 0.60 以下升级到 0.60 或更高版本时,可能会发生这种情况。展望未来,您可以通过“react-native unlink”取消链接此依赖项,它将自动包含在您的应用程序中。如果库与自动链接不兼容,请忽略此消息并通知库维护人员。
阅读有关自动链接的更多信息:https://github.com/react-native-community/cli/blob/master/docs/autolinking.md 信息 找到 Xcode 工作区“JustHelper.xcworkspace”
信息构建(使用“xcodebuild -workspace JustHelper.xcworkspace -configuration Debug -scheme JustHelper -destination id=BB2D702A-3FF7-4C11-863C-445B97ACFB83 -衍生DataPath build/JustHelper”)
..
..错误无法构建iOS项目。我们运行了“xcodebuild”命令,但它退出并显示错误代码 null。要进一步调试构建日志,请考虑通过打开 JustHelper.xcworkspace*** 使用 Xcode.app 构建您的应用程序
我正在使用react-native run-is命令通过终端运行React-native项目。我想在模拟器中运行它。首先我运行 npm install ,然后运行 react-native run-ios 。它显示错误
错误:找不到模块“metro-config”需要堆栈: - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/util/Config.js - /Users/tribond/Projects/JustHelper/ justhelper2/node_modules/react-native/local-cli/core/index.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cliEntry.js - /Users/tribond/Projects/ JustHelper/justhelper2/node_modules/react-native/local-cli/cli.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/cli.js - /usr/local/lib/node_modules/react-本机-cli/index.js