flutter_offline 库问题:iOS 中库的可达性冲突

flutter_offline library issue: Conflicts of library for Reachability in iOS

即使使用 Xcode 13.2.1,我的 flutter 应用 运行 也很好。在对代码进行了一些更改后,我尝试使用 iOS 构建它。它正在建设中。但是当我尝试为 Testflight 存档项目时,出现以下错误。

Multiple commands produce '/Users/mdhasanrahman/Library/Developer/Xcode/DerivedData/Runner-fgzktmibyndpbgfkmsizqhgncvxe/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Reachability.framework':

  1. Target 'Reachability' has create directory command with output '/Users/mdhasanrahman/Library/Developer/Xcode/DerivedData/Runner-fgzktmibyndpbgfkmsizqhgncvxe/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Reachability.framework'
  2. Target 'ReachabilitySwift' has create directory command with output '/Users/mdhasanrahman/Library/Developer/Xcode/DerivedData/Runner-fgzktmibyndpbgfkmsizqhgncvxe/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Reachability.framework'

还有一个目标完整性问题。

Multiple targets match implicit dependency for linker flags '-framework Reachability'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target 'Runner' from project 'Runner')

Target 'Reachability' (in project 'Pods')

Target 'ReachabilitySwift' (in project 'Pods')

在过去的 4 天里,我尝试了所有我能想到的解决方案。仍然没有运气。我目前在使用 M1 Max 处理器的 Flutter(Channel master,2.11.0-0.0.pre.450,在 macOS 12.1 上)。以下是 Podfile

# Uncomment this line to define a global platform for your project
# platform :ios, '9.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)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

您在 pubspec.yaml 文件中添加了多个连接插件。请删除所有其他插件,只放一个。

搜索了使用 Podfile.lock 中包的依赖项,在我的例子中是 keyboard_visibility 包导致了问题。