Skip to content

Instantly share code, notes, and snippets.

@Rich86man
Created March 7, 2016 20:01
Show Gist options
  • Save Rich86man/7548e47a5ee48ea5144e to your computer and use it in GitHub Desktop.
Save Rich86man/7548e47a5ee48ea5144e to your computer and use it in GitHub Desktop.
Fix pod info.plist versions to pass ITC Verification
post_install do |installer|
plist_buddy = "/usr/libexec/PlistBuddy"
installer.pods_project.targets.each do |target|
plist = "Pods/Target Support Files/#{target}/Info.plist"
version = `#{plist_buddy} -c "Print CFBundleShortVersionString" "#{plist}"`.strip
stripped_version = /([\d\.]+)/.match(version).captures[0]
version_parts = stripped_version.split('.').map { |s| s.to_i }
# ignore properly formatted versions
unless version_parts.slice(0..2).join('.') == version
major, minor, patch = version_parts
major ||= 0
minor ||= 0
patch ||= 999
fixed_version = "#{major}.#{minor}.#{patch}"
puts "Changing version of #{target} from #{version} to #{fixed_version} to make it pass iTC verification."
`#{plist_buddy} -c "Set CFBundleShortVersionString #{fixed_version}" "#{plist}"`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment