Skip to content

Instantly share code, notes, and snippets.

@anton-matosov
Last active December 26, 2015 22:57
Show Gist options
  • Save anton-matosov/2bcd42ded9092f2ba25b to your computer and use it in GitHub Desktop.
Save anton-matosov/2bcd42ded9092f2ba25b to your computer and use it in GitHub Desktop.
Podfile post_install hack which removes the beta suffix from version in info.plist to fix AppStore validation
# Podfile post_install hack which removes the beta suffix from version in info.plist to fix AppStore validation
# Credit to jerolimov comment https://github.com/ReactiveX/RxSwift/issues/206#issuecomment-158074615
post_install do |installer|
plist_buddy = "/usr/libexec/PlistBuddy"
installer.pods_project.targets.each do |target|
plist = "Pods/Target Support Files/#{target}/Info.plist"
original_version = `#{plist_buddy} -c "Print CFBundleShortVersionString" "#{plist}"`.strip
changed_version = original_version[/(\d+\.){1,2}(\d+)?/]
unless original_version == changed_version
puts "Fix version of Pod \"#{target}\": #{original_version} => #{changed_version}"
`#{plist_buddy} -c "Set CFBundleShortVersionString #{changed_version}" "#{plist}"`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment