运行pod安装后无法找到目标文件

时间:2017-08-07 18:45:00

标签: ios xcode react-native cocoapods react-native-maps

我正在使用react-native-maps并且我正在尝试使用Google Maps for iOS,并且我按照https://github.com/airbnb/react-native-maps/issues/693的上述说明执行此操作我从pod安装中收到错误:

无法找到名为AirMapsExplorer

的目标

这是我有的podfile

# 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 'AirMapsExplorer' do

  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
  pod 'React', path: '../../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'BatchedBridge'
  ]

  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS
  pod 'react-native-maps', path: '../../'
  pod 'react-native-google-maps', path: '../../'  # <~~ if you need GoogleMaps support on iOS

end


post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "react-native-google-maps"
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
  end
end

我重新启动了我的设备(现在2次)删除了pod文件夹和podfile,再次按照说明进行操作并得到相同的错误。我甚至尝试过干净的构建和清理文件夹仍无济于事。

任何人都有此错误或遇到一种方法来修复,如果你碰到这个。我没有定期使用xcode,因为我正在使用React Native构建并尽量不使用xcode,除非我绝对不得不使用iOS。

如果您希望我展示其他内容,我将帮助调试此问题。谢谢

1 个答案:

答案 0 :(得分:1)

当您启动此项目时,您需要在目标中添加由XCode创建的xcodeproj的名称,还需要检查您的.podFile是否在xcodeproj文件目录中,我也认为你错过了这一行

workspace 'AirMapsExplorer'

这将创建一个集成了pod的工作区

修改了您的pod文件

# 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'

workspace 'AirMapsExplorer'

# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'AirMapsExplorer' do

  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
  pod 'React', path: '../../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'BatchedBridge'
  ]

  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS
  pod 'react-native-maps', path: '../../'
  pod 'react-native-google-maps', path: '../../'  # <~~ if you need GoogleMaps support on iOS

end


post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "react-native-google-maps"
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
  end
end

希望这有帮助