ios React Native 0.71.8 build在Xcode 15上失败

nbnkbykc  于 2023-10-21  发布在  iOS
关注(0)|答案(4)|浏览(296)

今天我把Xcode从14.2更新到15,然后我得到了很多错误,如下所示:有人能给我给予吗?
我试着:
1.删除derivedData。
1.廉洁工程
1.重新安装pod
1.使用RN 0.72.5尝试
但没有运气XCode 15
Mac M1
React native 0.71.8
React 18.2.0
我已经在react native github repo上发布了这个问题,有人可以在这里查看更多:https://github.com/facebook/react-native/issues/39712
这是我的pod:

# Resolve react_native_pods.rb with node to allow for hoisting
def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, '13.0'
prepare_react_native_project!

setup_permissions([
  'Camera',
  'LocationAccuracy',
  'LocationAlways',
  'LocationWhenInUse',
  'MediaLibrary',
  'Microphone',
  'Notifications',
  'PhotoLibrary',
  'PhotoLibraryAddOnly',
])

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

# $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
# 'CocoaAsyncSocket', 'ComponentKit','Flipper-Fmt', 'Flipper-DoubleConversion',
# 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
# 'CocoaLibEvent', 'OpenSSL-Universal', 'Flipper-Boost-iOSX']

target 'VedaxLink' do
  use_modular_headers!
  # use_frameworks! :linkage => :static
  config = use_native_modules!

  $RNFirebaseAsStaticFramework = true
  
  # Flags change depending on the env values.
  flags = get_default_flags()
  use_react_native!(
      :path => config[:reactNativePath],
      # Hermes is now enabled by default. Disable by setting this flag to false.
      # :hermes_enabled => flags[:hermes_enabled],
      :fabric_enabled => flags[:fabric_enabled],
      :hermes_enabled => false,
      # Enables Flipper.
      #
      # Note that if you have use_frameworks! enabled, Flipper will not work and
      # you should disable the next line.
      :flipper_configuration => FlipperConfiguration.disabled,
      #https://github.com/facebook/flipper/issues/4278#issuecomment-1302015516
      # :flipper_configuration => FlipperConfiguration.enabled(["Debug", "Release"]),
      # An absolute path to your application root.
      :app_path => "#{Pod::Config.instance.installation_root}/.."
    )
    
    
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  

  
  #module pod
  pod 'Lightbox'
  pod 'Hero'
  pod 'QRCodeReader.swift', '~> 10.1.0'
  pod 'PopupDialog'
  pod 'FSCalendar'
  pod 'pop', '~> 1.0' #for chathead
  pod 'SnapKit'
  pod 'GoogleMLKit/SegmentationSelfie', '3.2.0'

  #global define SDWebImage for rn photo edittor + fast image
  pod 'SDWebImage', :modular_headers => true
  pod 'SDWebImageWebPCoder', :modular_headers => true
  #video editor
  pod 'HXPHPicker', '~> 1.4.6'
  
  post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
            # config.build_settings['VALID_ARCHS'] = 'arm64, arm64e, x86_64'
            # config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
            config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            config.build_settings["DEVELOPMENT_TEAM"] = '*********'
            config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
            #https://stackoverflow.com/questions/75929888/xcode-14-3-failed-to-verify-module-interface-of-project
            config.build_settings['OTHER_SWIFT_FLAGS'] = '-no-verify-emitted-module-interface'
        end
    end
    
    react_native_post_install(
          installer,
          config[:reactNativePath],
          :mac_catalyst_enabled => false
      )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

bqjvbblv

bqjvbblv1#

步骤1
在pod文件中找到爱马仕代码并禁用它

use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
                    
  )

在podfile的末尾添加以下代码块

use_flipper!({ "Flipper-DoubleConversion" => "1.1.7" })

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

在iOS中低于命令运行

$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod clean
$ pod install

take a look here also

dzjeubhm

dzjeubhm2#

我想你的Podfile在flipper配置中有一些问题。请使用此Pod文件配置。

platform :ios, '13.0'
# Resolve react_native_pods.rb with node to allow for hoisting
 def node_require(script)
   # Resolve script with node to allow for hoisting
   require Pod::Executable.execute_command('node', ['-p',
     "require.resolve(
       '#{script}',
       {paths: [process.argv[1]]},
     )", __dir__]).strip
 end

 node_require('react-native/scripts/react_native_pods.rb')
 node_require('react-native-permissions/scripts/setup.rb')

prepare_react_native_project!

setup_permissions([
  'AppTrackingTransparency',
  'Camera',
  'Contacts',
  'LocationWhenInUse',
  'MediaLibrary',
  'Notifications',
  'PhotoLibrary',
  'PhotoLibraryAddOnly',
  'Microphone'
])

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
#flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end
pod 'Google-Mobile-Ads-SDK', '~> 8.0'
pod 'GoogleMobileAdsMediationFacebook'

target 'PhoneTrackerByNumberPro' do
  config = use_native_modules!
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true
  $RNGoogleMobileAdsAsStaticFramework = true
  $RNAdMobAsStaticFramework = true
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    #:flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'PhoneTrackerByNumberProTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
falq053o

falq053o3#

你可以尝试转到/ios目录,然后通过执行pod install --verbose来检查终端的输出,因为从目前来看,你只能看到你的iOS项目缺少一些组件。
我希望你能增加更多的内容,但总体来说这不是一个大问题。

slmsl1lt

slmsl1lt4#

可能对你来说不是正确的答案,但我刚刚在iOS上经历了一些棘手的构建问题。
我学到了:

  • 将RN提高到0.72.5,最初对爱马仕的更改非常错误
  • 重新生成项目文件夹,这是从核心idk中删除的,为什么,但有一个软件包可以轻松完成

yarn add react-native-eject npx react-native eject

相关问题