【问题标题】:Lexical or preprocessor issue in Xcode 8.0Xcode 8.0 中的词法或预处理器问题
【发布时间】:2017-08-08 21:57:47
【问题描述】:

我正在使用 react native: 0.41.2、react: 15.4.2 和 cocoapods for firebase(https://github.com/evollu/react-native-fcm)。 我在构建代码时遇到问题。 'React/RCTEventEmitter.h', 'React/RCTBridgeModule.h', 'React/RCTViewManager.h', 'React/RCTDefines.h' 这些文件未找到错误在运行项目时抛出.

但是通过使用该文件名单击 ctrl,这些文件已经在我的项目中。 Image

podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'

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

  # Pods for Inspector
  react_native_path = "../node_modules/react-native"
  pod "React", :path => react_native_path, :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  target 'Inspector-tvOSTests' do
    inherit! :search_paths
    pod 'Firebase/Messaging'
    # Pods for testing
  end

  target 'InspectorTests' do
    inherit! :search_paths
    pod 'Firebase/Messaging'
    # Pods for testing
  end

end

【问题讨论】:

    标签: ios xcode firebase react-native cocoapods


    【解决方案1】:

    对于那些面临这个问题的人,这是由于 react native 0.41.2 和 cocoapods 的标头导入问题 要解决这些错误,请按照以下步骤操作

    1npm install -g react-native-git-upgrade

    2 转到您的项目根文件夹并执行

    react-native-git-upgrade
    

    3 升级RN时出现冲突解决

    4 现在从 pod 文件中删除 React 依赖项,否则您将有两个 React 方案(一个 RN 和一个 Pod),它将在构建时导致 no input error。您的 pod 文件应如下所示

    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'
    source 'https://github.com/CocoaPods/Specs.git'
    
    target 'Inspector' do
      # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
      # use_frameworks!
    
      # Pods for Inspector   // Pods for your app, in this case firebase is used
      pod 'Firebase/Core'
      pod 'Firebase/Messaging'
      target 'Inspector-tvOSTests' do
        inherit! :search_paths
        pod 'Firebase/Messaging'
        # Pods for testing
      end
    
      target 'InspectorTests' do
        inherit! :search_paths
        pod 'Firebase/Messaging'
        # Pods for testing
      end
    
    end
    

    5 cd ios && pod 安装

    6 关闭 Xcode 并打开 .xcworkspace 文件

    【讨论】:

    • 我对原生 0.50.3 做出了反应,我也遇到了类似的问题。你认为我也可以用这个来解决它吗? @hariks
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 2022-08-08
    相关资源
    最近更新 更多