2024-09-06 flutter+rn 多target 在i

2024-09-05  本文已影响0人  TsingQue
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, '15.0'
prepare_react_native_project!
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

flutter_application_path = '../vr'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

config = use_native_modules!

def share_pods
  use_frameworks!
  
  pod 'Toast-Swift', '5.0.1'
  pod 'Alamofire','5.9.1'
  
end


target 'iOS' do
  share_pods
  
  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  install_all_flutter_pods(flutter_application_path)
end

target 'iOS_Beta' do
  share_pods
  
  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  install_all_flutter_pods(flutter_application_path)
end


target 'iOS_Dev' do
  share_pods
  
  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  install_all_flutter_pods(flutter_application_path)
end


pre_install do |installer|
     installer.pod_targets.each do |pod|
       if pod.name.eql?('RNReanimated')
         def pod.build_type
           Pod::BuildType.static_library
        end
    end
  end
end

post_install do |installer|
  # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
  flutter_post_install(installer) if defined?(flutter_post_install)
  react_native_post_install(
    installer,
    config[:reactNativePath],
    :mac_catalyst_enabled => false,
    # :ccache_enabled => true
  )
  installer.pods_project.targets.each do |target|
    ... # Here are some configurations automatically generated by flutter
    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
         'PERMISSION_CAMERA=1',
         'PERMISSION_PHOTOS=1',
      ]
    end
  end
end
上一篇 下一篇

猜你喜欢

热点阅读