/ app / ios / Podfile
Podfile
 1  platform :ios, '15.0'
 2  
 3  # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
 4  ENV['COCOAPODS_DISABLE_STATS'] = 'true'
 5  
 6  project 'Runner', {
 7    'Debug' => :debug,
 8    'Profile' => :release,
 9    'Release' => :release,
10  }
11  
12  def flutter_root
13    generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
14    unless File.exist?(generated_xcode_build_settings_path)
15      raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
16    end
17  
18    File.foreach(generated_xcode_build_settings_path) do |line|
19      matches = line.match(/FLUTTER_ROOT\=(.*)/)
20      return matches[1].strip if matches
21    end
22    raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
23  end
24  
25  require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26  
27  flutter_ios_podfile_setup
28  
29  # Allow TSBackgroundFetch and Tor static xcframeworks alongside dynamic pods
30  pre_install do |installer|
31    installer.pod_targets.each do |pod|
32      if ['background_fetch', 'TSBackgroundFetch', 'Tor'].include?(pod.name)
33        def pod.build_type
34          Pod::BuildType.static_framework
35        end
36      end
37    end
38  end
39  
40  target 'Runner' do
41    use_frameworks!
42  
43    flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
44  
45    # Tor.framework for onion service hosting
46    pod 'Tor', '~> 408'
47  
48    target 'RunnerTests' do
49      inherit! :search_paths
50    end
51  end
52  
53  post_install do |installer|
54    installer.pods_project.targets.each do |target|
55      flutter_additional_ios_build_settings(target)
56    end
57  
58    # Link Network.framework for iroh (QUIC NAT traversal uses nw_path_monitor)
59    installer.pods_project.targets.each do |target|
60      if target.name == 'Pods-Runner'
61        target.build_configurations.each do |config|
62          xcconfig_path = config.base_configuration_reference.real_path
63          xcconfig = File.read(xcconfig_path)
64          unless xcconfig.include?('-framework "Network"')
65            xcconfig = xcconfig.gsub(/OTHER_LDFLAGS = (.*)$/, 'OTHER_LDFLAGS = \1 -framework "Network"')
66            File.write(xcconfig_path, xcconfig)
67          end
68        end
69      end
70    end
71  
72    # Fix case-insensitive filesystem collision between Tor.framework (ObjC wrapper)
73    # and tor.framework (C library). On macOS APFS, -framework "tor" resolves to
74    # Tor.framework instead. Copy the C library to a uniquely named file.
75    pods_dir = File.join(__dir__, 'Pods')
76    tor_src = File.join(pods_dir, 'Tor', 'tor.xcframework', 'ios-arm64', 'tor.framework', 'tor')
77    tor_dst = File.join(pods_dir, 'libtor_c.a')
78  
79    if File.exist?(tor_src)
80      FileUtils.cp(tor_src, tor_dst)
81      puts "[DeadDrop] Copied tor C library to #{tor_dst}"
82    end
83  
84    # Patch xcconfig files: remove -framework "tor" (case collision)
85    Dir.glob(File.join(pods_dir, 'Target Support Files', '**', '*.xcconfig')).each do |path|
86      content = File.read(path)
87      if content.include?('-framework "tor"')
88        content = content.gsub(/-framework "tor"/, '')
89        File.write(path, content)
90      end
91    end
92  end