1

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?

Yanni
  • 580
  • 2
  • 6
  • 21

2 Answers2

3

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.

cicerocamargo
  • 1,046
  • 9
  • 9
-1
  • Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") should give you version number
  • Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") should give you build number
Pavan Kotesh
  • 143
  • 13