简体   繁体   English

xcode项目中如何获取最小部署目标

[英]How to get the minimum deployment target in the xcode project

I want to retrieve the minimum deployment target in the xcode project.我想检索 xcode 项目中的最小部署目标。 IPHONEOS_DEPLOYMENT_TARGET = 13.2; IPHONEOS_DEPLOYMENT_TARGET = 13.2; I wanted to check whether the version is 13.2 or lesser.我想检查版本是 13.2 还是更低。 Is there any way or any command which returns the deployment target.是否有任何方法或任何命令返回部署目标。 I want to read it from the ruby code.我想从 ruby 代码中读取它。

you can check the target version by below code and perform your desired action您可以通过以下代码检查目标版本并执行所需的操作

In Swift:在 Swift 中:

    if #available(iOS 13.2, *) {
        // your code for iOS 13.2 or above versions
    } else {
        // Fallback on earlier versions or your code for earlier versions
    }

In Objective C:在目标 C 中:

    if (@available(iOS 13.2, *)) {
        // your code for iOS 13.2 or above versions
     } else {
        // Fallback on earlier versions or your code for earlier versions
     }

In Ruby:在 Ruby 中:

Using the plist gem, like this:使用 plist gem,如下所示:

require 'plist'
info = Plist.parse_xml('path/to/Info.plist')
puts info["CFBundleShortVersionString"]
puts info["CFBundleVersion"]

Use this reference: How to get target's version by Ruby (or Xcodeproj)使用此参考: How to get target's version by Ruby (or Xcodeproj)

also, https://www.rubydoc.info/gems/xcodeproj/Xcodeproj/Project/Object/XCConfigurationList另外, https://www.rubydoc.info/gems/xcodeproj/Xcodeproj/Project/Object/XCConfigurationList

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM