如何在Codemagic中指定目标平台的iOS版本号

9

我正在尝试在Codemagic上构建我的应用程序的iOS版本,但没有Mac电脑。构建失败并出现以下消息。

 [!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] CocoaPods could not find compatible versions for pod "flutter_facebook_login":
  In Podfile:
    flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`)

Specs satisfying the `flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`)` dependency were found, but they required a higher minimum deployment target.

看起来 flutter_facebook_login 包的 iOS 版本要求高于 iOS 8。如果我能指定一个更高的 iOS 版本,那么这个问题就可以解决。我该怎么办?

2个回答

6
最终,我通过手动创建 Podfile 解决了问题,具体操作如下。
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
use_frameworks!
use_modular_headers!

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!
  use_modular_headers!
  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

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


1

您可以在Podfile中取消注释目标。 或者您可以添加

platform :ios, '11.0'

在你的Pod文件顶部,你可以在引号内指定你需要的版本。


我已经尝试过了。现在我又遇到了另一个错误:致命错误:找不到模块“FBSDKCoreKit”。 - Mutlu Simsek
尝试在目录中删除Podfile.lock和pods文件夹后执行pod install。 - vishnu anilkumar
我没有苹果电脑。在Windows上可以吗? - Mutlu Simsek
我认为你需要一台Mac来构建你的iOS应用程序。因为你需要安装pods文件,还需要Xcode来进行构建。 - vishnu anilkumar
Codemagic和其他一些工具声称可以在没有Mac的情况下进行开发,这让人感到沮丧。 - Mutlu Simsek

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接