升级Xcode 12.5后在iOS上运行react native失败

升级Xcode 12.5后在iOS上运行react native失败,ios,swift,react-native,cocoapods,xcode12.5,Ios,Swift,React Native,Cocoapods,Xcode12.5,尝试在iOS模拟器whit MacBook Air M1上启动react本机项目失败,出现此错误 :0:错误:未找到模块映射文件“/Users/userName/Library/Developer/Xcode/DerivedData/projectName czhmfookabhyqzdsutttonzlxlnsi/Build/Products/Debug iphonesimulator/FBSDKCoreKit/FBSDKCoreKit.modulemap” :0:错误:模块映射文件 “/Us

尝试在iOS模拟器whit MacBook Air M1上启动react本机项目失败,出现此错误

:0:错误:未找到模块映射文件“/Users/userName/Library/Developer/Xcode/DerivedData/projectName czhmfookabhyqzdsutttonzlxlnsi/Build/Products/Debug iphonesimulator/FBSDKCoreKit/FBSDKCoreKit.modulemap”
:0:错误:模块映射文件 “/Users/erName/Library/Developer/Xcode/DerivedData/projectName czhmfookabhyqzdsutttonzlxnsi/Build/Products/Debug iphonesimulator/FBSDKCoreKit/FBSDKCoreKit.modulemap”未找到
:0:错误:缺少必需的模块“SwiftShims”

**构建失败**

以下生成命令失败:

CompileSwift normal x86_64[项目文件夹的路径]/ios/File.swift
CompileSwiftSources普通x86_64 com.apple.xcode.tools.swift.compiler

我已经试过了

  • 使用Xcode打开.xcworkspace
  • 删除节点_模块、package-lock.json和podfile.lock
  • npm安装
  • 在iOS文件夹中安装pod
  • 清除DerivedData文件夹
  • 重建项目

信息#

吊舱文件
平台:ios,“10.0”
需要_relative'../node_modules/@react native community/cli平台ios/native_modules'
目标“[tName]”是否执行
权限\u路径=“../node\u模块/react本机权限/ios”
pod'权限摄像头',:path=>“#{permissions_path}/Camera”
pod'FBLazyVector',:path=>“./node_modules/react native/Libraries/FBLazyVector”
pod'FBReactNativeSpec',:path=>“./node_modules/react native/Libraries/FBReactNativeSpec”
pod'RCTRequired',:path=>“./node_modules/react native/Libraries/RCTRequired”
pod'RCTTypeSaffety',:path=>“./node_modules/react native/Libraries/TypeSafety”
pod'React',:path=>'../node_modules/React native/'
pod'React Core',:path=>'../node_modules/React native/'
pod“React CoreModules',:path=>“../node_modules/React native/React/CoreModules”
pod“React Core/DevSupport”,路径=>'../node_modules/React native/'
pod“React RCTActionSheet”,:path=>“../node_modules/React native/Libraries/ActionSheetIOS”
pod“React RCTAnimation”,路径=>“../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 Core/RCTWebSocket”,:path=>“../node_modules/React native/”
pod'React cxxreact',:path=>'../node_modules/React native/ReactCommon/cxxreact'
pod'React jsi',:path=>'../node_modules/React native/React Common/jsi'
pod'React-jsiexecutor',:path=>'../node_modules/React-native/React-Common/jsiexecutor'
pod“React-jsinspector',:path=>“../node_modules/React-native/React-Common/jsinspector”
pod'ReactCommon/jscallinvoker',:path=>“./node_modules/react native/ReactCommon”
pod“ReactCommon/turbomodule/core”,路径=>“./node_模块/ReactNative/ReactCommon”
pod“Yoga”,路径=>“../node_模块/react native/react common/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‘谷歌签名’,“~>5.0.2”
#本地地理定位服务
pod“react native geolocation”,路径:“../node_modules/@react native community/geolocation”
#使用你的框架!
吊舱“TwitterKit5”
#谷歌idfa支持
pod‘GoogleIDFasuSupport’,“~>3.14”
目标“[tNameTests]”执行
继承!:搜索路径
#测试用吊舱
结束
使用本机模块!
#谷歌地图需要
rn_映射_路径=“../node_模块/react本机映射”
pod“react native google maps',:path=>rn\u maps\u path
pod“谷歌地图”
pod“谷歌地图iOS实用程序”
结束
目标'[tName]-tvOS'do
#[tName]-tvOS的播客
目标'[tName]-tvOSTests'do
继承!:搜索路径
#测试用吊舱
结束
结束
安装后的do安装程序|
##修复XCode 12.5测试版
查找并替换(“../node\u modules/react native/react/cxbridge/RCTCxxBridge.mm”,“初始化模块:(NSArray*)模块”,“初始化模块:(NSArray*)模块”)
查找并替换(“../node\u modules/react native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm”,
“RCTBridgeModuleNameForClass(module)),“RCTBridgeModuleNameForClass(Class(module))”)
结束
def查找和替换(dir、findstr、replacestr)
Dir[Dir]。每个do |名称|
text=File.read(名称)
replace=text.gsub(findstr,replacestr)
如果文本!=代替
放置“修复:+名称”
File.open(名称,“w”){| File | File.replace}
冲洗
结束
结束
Dir[Dir+'*/']。每个(&方法(:find_和_replace))
结束

不仅仅是你,这是一个悬而未决的问题。以下是指向和的链接:

System:
    OS: macOS 11.3 
    CPU: (8) arm64 Apple M1 
    Memory: 177.69 MB / 8.00 GB 
    Shell: 5.8 - /bin/zsh 
  Binaries: 
    Node: 15.14.0 - /opt/homebrew/bin/node 
    npm: 7.7.6 - /opt/homebrew/bin/npm 
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman 
  SDKs: 
    iOS SDK: 
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 
    Android SDK: 
      API Levels: 27, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3 
      System Images: android-29 | Automotive with Play Store Intel x86 Atom, android-29 | Android TV Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom 
  IDEs: 
    Android Studio: 4.1 AI-201.8743.12.41.7199119 
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild 
  npmPackages: 
    react: 16.9.0 => 16.9.0  
    react-native: ^0.61.5 => 0.61.5  
  npmGlobalPackages: 
    react-native-cli: 2.0.1 
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target '[tName]' do

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  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-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  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 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  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 'GoogleSignIn', '~> 5.0.2'
  
  # react-native-geolocation-service
  pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'

  # use_frameworks!
  pod 'TwitterKit5'

#  google idfa support
  pod 'GoogleIDFASupport', '~> 3.14'

  target '[tNameTests]' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
  
#  GOOGLE MAPS REQUIRE
  rn_maps_path = '../node_modules/react-native-maps'
   pod 'react-native-google-maps', :path => rn_maps_path
   pod 'GoogleMaps'
   pod 'Google-Maps-iOS-Utils'
   
end

  target '[tName]-tvOS' do
   # Pods for [tName]-tvOS

   target '[tName]-tvOSTests' do
     inherit! :search_paths
     # Pods for testing
   end

end
    
 post_install do |installer|
     ## Fix for XCode 12.5 beta
     find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
     find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
         "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
 end

 def find_and_replace(dir, findstr, replacestr)
   Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
       if text != replace
           puts "Fix: " + name
           File.open(name, "w") { |file| file.puts replace }
           STDOUT.flush
       end
   end
   Dir[dir + '*/'].each(&method(:find_and_replace))
 end