swift - Flutter:Cocoapods 'Pods-Runner' 目标具有传递依赖项,包括静态二进制文件:Flutter.framework

标签 swift xcode dart flutter podfile

运行 pod install 时出现此错误

[!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/Users/me/Documents/flutter/flutter/bin/cache/artifacts/engine/ios/Flutter.framework)

在做了一些研究后,它说我的 Podfile 中的 use frameworks! 导致了这个问题。如果我注释掉 use frameworks! 我会收到此错误。知道问题是什么吗?在过去的三天里,我一直被困在这里。

ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see invocation)

还根据 here 所写的内容.将以下内容添加到 Podfile 对我也不起作用。这就是我的 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'

def parse_KV_file(file,seperator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=seperator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname,:path=>podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  # Flutter Pods
  #use_frameworks!

  pod 'EstimoteSDK'
  pod 'SwiftKeychainWrapper'
  pod 'Alamofire'

  generated_xcode_build_settings = parse_KV_file("./Flutter/Generated.xcconfig")
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first."
  end
  generated_xcode_build_settings.map{ |p|
    if p[:name]=='FLUTTER_FRAMEWORK_DIR'
      pod 'Flutter', :path => p[:path]
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file("../.flutter-plugins")
  plugin_pods.map{ |p|
    pod p[:name], :path => File.expand_path("ios",p[:path])
  }
end

pre_install do |installer|
      # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
      Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

最佳答案

对于我来说,我删除了 ios/Flutter/Flutter.framework 文件夹并再次安装 pod pod install 然后它就可以工作了。

关于swift - Flutter:Cocoapods 'Pods-Runner' 目标具有传递依赖项,包括静态二进制文件:Flutter.framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50306019/

相关文章:

ios - 将 Web 应用程序获取到应用程序商店

flutter - Flutter:使用Switch语句未更改颜色

ios - 从 SwiftUI 上的部分列表中删除项目

objective-c - 使用 Cocoa Bindings,以编程方式更改 NSTextField 的值不会更新模型

ios - Xcode 4 iOS 项目结构问题

dart - flutter : Get Local position of Gesture Detector

flutter - 方法 'copy' 没有为类型 'PickedFile' 定义

facebook - block for-in 循环

iphone - 境界+快速排序

objective-c - 如何使用 setContentView 更改停靠栏图标以在 mac os x 中显示一个大字符