【问题标题】:About 100 error in Xcode, Undefined symbols for architecture x86_64 :upgraded react-native from 0.59.1 to 0.60.5Xcode 中大约 100 个错误,架构 x86_64 的未定义符号:将 react-native 从 0.59.1 升级到 0.60.5
【发布时间】:2019-09-12 09:10:54
【问题描述】:

我一直在尝试升级我的项目并将 cocoapods 用于 ios, 每当我从 xcode 构建时,它都会给我 100 个与 swift 相关的错误, - 我的项目不依赖于 swift - 升级所有包

请查找错误截图

PackageList Screenshot!

Xcode Error Screenshot!

Xcode Error Screenshot1!

Xcode Error Screenshot2!

我已按照以下链接进行软件包升级 react-native-community link!

发现同样的错误flutter! - 没试过这个

# platform :ios, '9.0'

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'


target 'test' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for test
  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec =>   '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'react-native-print', :path => '../node_modules/react-native-print'
  pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
  pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage'
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
  pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  pod 'react-native-html-to-pdf', :path => '../node_modules/react-native-html-to-pdf'
  pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
  pod 'RNShare', :path => '../node_modules/react-native-share'
  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
  pod 'RNSVG', :path => '../node_modules/react-native-svg'
  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
  pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'
  pod 'lottie-ios', :path => '../node_modules/lottie-ios'

  pod 'Firebase/Core', '~> 6.3.0'

  #pod 'OneSignal', '>= 2.9.3', '< 3.0'


  # Required by RNFirebase
  pod 'Firebase/Core', '~> 6.3.0'

  #target 'OneSignalNotificationServiceExtension' do
  #  pod 'OneSignal', '>= 2.6.2', '< 3.0'
  #end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
      end
    end
  end

  use_native_modules!
end

target 'test-tvOSTests' do
  inherit! :search_paths
  # Pods for testing
end

target 'testTests' do
  inherit! :search_paths
  # Pods for testing
end

target 'test-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

end```


Expecting it should have been worked easily

【问题讨论】:

    标签: ios react-native cocoapods


    【解决方案1】:

    试试这个:

    1. 在 Xcode 中打开 ios/YourAppName.xcodeproj
    2. 在左侧的 Project Navigator 中右键单击 Your App Name,然后单击 New File…
    3. 为项目创建一个空的 Swift 文件(确保在添加时选择了 Your App Name 目标)
    4. 当 Xcode 询问时,按 Create Bridging Header 然后不要删除 Swift 文件。重新运行您的构建。

    这应该可以解决问题

    在github上找到:https://github.com/mxcl/PromiseKit/issues/1059#issuecomment-493925940

    【讨论】:

    • 这对我有用!但我想添加 Swift 文件不是 React Native 解决方案。还有其他选择吗?
    【解决方案2】:

    请按以下步骤操作:

    1. 检查应用开发者 ID 是否已登录
    2. 为您的 React Native 清理您的构建 步骤:How can I clean my react-native project to back it up?
    3. 关闭你的 Xcode
    4. 从 xworkspace 打开您的项目

    【讨论】:

      【解决方案3】:

      Xcode 12 可能会出现此问题。我创建了一个脚本来解决此问题。你可以在这里找到它:https://gist.github.com/HosseinRashno/4786b289356ad9840b6c087ce8191fe4

      这里你可以找到问题的原因:https://github.com/facebook/react-native/issues/29633#issuecomment-694187116

      问题是这些库的所有 podspec 都未能 链接依赖于 React pod,它实际上只是一把雨伞 纯 JS 应用程序依赖的依赖项,而本机 这些库所依赖的 API 实际上位于 React-Core 豆荚。

      这意味着它们在技术上总是不正确的——在概念上 应该始终明确地依赖于提供 API 的库 你依赖,而不是依赖传递依赖——但它 似乎在以前的 Xcode 版本中构建系统工作 不同并且具有传递依赖关系只是 正好上班?‍♂️

      正确的解决方法是让所有这些库更新它们的 从 React 到 React-Core 的依赖关系:

      删除:s.dependency 'React'
      地址:s.dependency 'React-Core'

      【讨论】:

      • 我已从React 更改为React-Core,它不起作用。我遇到了 react-native-geolocation` 问题,该问题在 xcode 11 上有效,但在 xcode 12 上无效。问题是Geolocation.watchposition 不起作用。
      【解决方案4】:

      在 YourAppName > Build Setting > Search paths > Framework Search Paths 中添加这一行

      $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
      

      它会起作用的

      【讨论】:

        【解决方案5】:

        由于最终的解决方案不仅仅是嵌入一个桥接头,“始终嵌入 Swift 标准 Libraris”在构建目标中也有任何 Swift 文件,而不仅仅是在 pod 中。看起来 XCode 优化器正在删除,即使“始终”为 YES。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-03-01
          • 2021-04-13
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多