React Native XCode 项目产品存档因架构 arm64 的重复符号而失败 [英] React Native XCode Project Product Archive Fails with duplicate symbols for architecture arm64

查看:55
本文介绍了React Native XCode 项目产品存档因架构 arm64 的重复符号而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的是,我似乎无法让存档在 XCode 中工作,但是如果我不尝试存档而只是构建发布版本,则构建成功而不会出现重复符号的错误.该项目也可以在设备上正确构建.

Strangely, I can't seem to get Archive to work in XCode but the build succeeds without the errors on duplicate symbols if I do not attempt to Archive but simply build a release version. The project builds properly on devices as well.

我已经搜索了这个主题并尝试禁用可测试性,并将项目设置中的无公共块"也设置为否",但到目前为止还没有运气.

I have searched up on this topic and tried disabling testability, and setting the 'No Common Blocks' in the project settings to NO as well but no luck so far.

该项目是一个基于 React Native 0.40 的项目,也安装了 CocoaPods.PodFile 是这个

The Project is a React Native 0.40 based project with CocoaPods installed as well. PodFile is this

# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'

# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'StreetSmart' do
  pod 'React', path: '../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS

# when not using frameworks  we can do this instead of including the source files in our project (1/4):
#  pod 'react-native-maps', path: '../../'
#  pod 'react-native-google-maps', path: '../../'  # <~~ if you need GoogleMaps support on iOS
end

XCode 版本为 8.2.1,由于安装了 Pod,项目文件通过 .xcworkspace 打开.

XCode Version is 8.2.1, and the project file is opened via .xcworkspace since pods are installed.

非常感谢您对此的任何帮助或见解,已在此停留数小时.

Would really appreciate any help or insight on this, been stuck at this for hours.

推荐答案

在另一个react-native项目上找到相关问题后终于解决了此处.

Finally solved the problem after finding a relevant issue on another react-native project here.

答案是Xcode项目中有两份React Native,一份来自CocoaPods,另一份作为子项目.只需删除 Xcode 内 Libraries 下 Podfile 中已经声明的所有模块,清理并重试后错误消失.

The answer is that there is two copies of React Native in the Xcode project, one from CocoaPods and another as a subproject. Just remove all modules that were already declared in Podfile under the Libraries inside Xcode and the error goes away after a clean and re-try.

这个问题的有趣之处在于,Debug 和 Release 中的所有构建都可以工作,但在尝试将项目存档以进行分发时却失败了.

What's interesting about this issue is that all builds in Debug and Release works but it fails when attempting to Archive the project for distribution.

[2017 年 5 月 2 日更新]

[Update 2 May 2017]

当您使用 react-native run-ios/android 运行代码时,我上面描述的解决方案可能会导致调试时错误,尽管它允许项目成功存档.

The solution I described above can cause debug-time errors when you run your code with react-native run-ios/android though it allows the project to be successfully archived.

另一种方法是从 LibrariesPodfile Podfile 中删除那些重复的模块声明而不是 Libraries 文件夹.当然,运行相关的 pod 命令,清理你的项目等.

An alternative method is to remove those duplicate modules that exist both in Libraries and Podfile from the Podfile declaration instead of the Libraries folder. And of course run the relevant pod commands, clean your project etc.

这样做可以让我的代码存档并运行而不会出现调试时错误

Doing this allowed my code to archive and also run without debug-time errors

这篇关于React Native XCode 项目产品存档因架构 arm64 的重复符号而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆