Podfile 3.49 KB
# Uncomment this line to define a global platform for your project
#platform :ios, '12.0'
#source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
platform :ios, '15.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

pod 'SDWebImage', :git => 'https://gitee.com/mirrors/SDWebImage.git', :branch => '5.21.3', :modular_headers => true

pod 'SDWebImageWebPCoder', :git => 'https://gitee.com/mirrors_SDWebImage/SDWebImageWebPCoder.git', :branch => '0.13.0', :modular_headers => true

# pod 'Mantle', :git => 'https://gitee.com/mirrors/Mantle.git' , :tag => '2.0.2'

flutter_ios_podfile_setup

target 'Runner' do
  #use_frameworks!
  use_frameworks! :linkage => :static
  use_modular_headers!
  # pod 'SDWebImage', :modular_headers => true
  # pod 'SDWebImageWebPCoder', :modular_headers => true
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  # ================= 添加下面这一行 =================
  # 强制引入 FFmpeg 原生库 (版本 6.0 对应 ffmpeg_kit_flutter_new 3.2.0)
  # 这会自动下载包含 FFmpegKitConfig.h 的 Framework
  # pod 'ffmpeg-kit-ios-min-gpl', '~> 6.0'
  # =================================================

  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    
    # 解决有些库构建版本不一致的问题
    target.build_configurations.each do |config|
        # 强制统一所有第三方库的 iOS 版本为 13.0,防止某些库仍然用旧版本编译导致头文件路径错误
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
        
        # 解决 "signing for xxx requires a development team" 的报错
        # 解决 M系列芯片(M4 Pro)可能的签名问题
        config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
        config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
        config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"

        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'PERMISSION_CAMERA=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'PERMISSION_PHOTOS=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'PERMISSION_MICROPHONE=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'PERMISSION_LOCATION=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'PERMISSION_BLUETOOTH=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'PERMISSION_LOCAL_NETWORK=1'

    end
  end
end