Search code examples
iosrubyxcodecocoapodsxcodeproj

How to get target's version by Ruby (or Xcodeproj)


How to get target's version(The version of you APP) in Ruby or Xcodeproj?

I have tried sdk_version in AbstractTarget with Xcodeproj, But it returns nil.

If Xcodeproj doesn't support it. How to get the version by Ruby?


Solution

  • I did this in Ruby using the plist gem, like this:

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

    I hope it helps.