使用 forcereact 创建的 Salesforce React Native 示例应用程序无法在 iOS 中构建,但不能在 Android 中构建

时间:2021-03-19 09:16:56

标签: ios xcode react-native salesforce

我开始根据 link 使用 Salesforce 学习 ReactNative。 我能够使用“forcereact create”生成基本代码,也能够通过 Visual Studio 运行 Android 版本(一开始有一些小问题,比如 Path issue ,等等)。 但是当尝试为 iOS 运行该应用程序时,它无法加载几乎所有在线找到的解决方案

  1. 降级可可豆
  2. 为 pod 文件中的单个项目添加路径
  3. 更改构建设置以指向最新的 iOS 版本
  4. 卸载,重新安装 pod

但问题仍未解决,在不同的工具中也会引发不同的错误。请查找附件以供参考。

请让我知道我哪里出错了。

系统详情:

system details

已安装的软件版本:

Installed Softwares

在 Xcode 中启动构建后,它会立即引发过多的折旧、问题和 1 个错误,然后可能会在解决时添加更多错误。

从另一个 stackoverflow 问题尝试了在 pod 文件中添加如下路径的解决方案,但问题仍然存在:

path adding in Pod file

错误详情如下。

在Xcode中: 它显示了 309 个警告和 1 个错误

Warnings and error in Xcode

Xcode 中的详细错误

Undefined symbols for architecture x86_64:  "_OBJC_CLASS_$_RCTImageLoader", referenced from:
  objc-class-ref in RNSScreenStackHeaderConfig.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Showing Recent Errors Only Undefined symbol: _OBJC_CLASS_$_RCTImageLoader

Xcode error detail

终端错误:

Terminal error 1

Terminal error 2

1 个答案:

答案 0 :(得分:1)

找到了一个提到 here 的解决方法建议,但它对我没有太大帮助,所以如果它可以帮助其他人,请在此处添加

实际对我有用的解决方案来自GithHub

我所要做的就是添加框架名称并修改if循环如下

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNScreens') || pod.name.eql?('RNCMaskedView')
      def pod.build_type
       Pod::BuildType.static_library
      end
    end
  end
end

一旦您的 pod 文件更新

转到终端并指向项目中的 ios 文件夹并执行“pod install”

完成 Pod 安装后,转到 Xcode,按 Command(或 Cmd)⌘ + Shift ⇧ + K 清除构建

然后运行您的应用程序,它将开始正常运行。

注意:- 如果抛出任何新框架错误,请继续将其添加到 if 循环中