Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make the default target for `platform :osx` the current system's version #579

Closed
wants to merge 1 commit into from

2 participants

@croach

Installing AFNetworking is currently not working for platform :osx when target isn't defined (issue #578). This is due to the default target being hard coded to a version less than the minimum one that AFNetworking supports. This change makes the default target dynamic; If target is not specified in the podfile, the code will query the system for the current OS X version and use that as its target version, but will fallback to using 10.6 if it fails to get the current system's version. This should be a better default target since it will allow packages that take advantage of the most recent system's benefits to be installed in most cases without specifying the target in the podfile.

@croach croach Make the default target for `platform :osx` the current system's version
This change makes the default target when the platform is `:osx` the
system's version of OS X if it can be found by querying the
system. Otherwise the default '10.6' is used. Setting the target in
the podfile still overrides the default target.
dec9d1c
@fabiopelosin
Owner

I'm closing this one because, what we plan to do is to inspect the integrated target (if integrating a user project during an installation) and take the platform from that target if not specified in the Podfile. I think that this would be the best solution.

@croach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 6, 2012
  1. @croach

    Make the default target for `platform :osx` the current system's version

    croach authored
    This change makes the default target when the platform is `:osx` the
    system's version of OS X if it can be found by querying the
    system. Otherwise the default '10.6' is used. Setting the target in
    the podfile still overrides the default target.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/cocoapods/podfile.rb
View
8 lib/cocoapods/podfile.rb
@@ -223,7 +223,13 @@ def platform(name, target = nil)
when :ios
target = '4.3'
when :osx
- target = '10.6'
+ # Get the current version of OS X if we can, otherwise default to 10.6
+ begin
+ os_version = `sw_vers -productVersion`.chomp
+ target = os_version.split('.')[0, 2].join('.')
+ rescue
+ target = '10.6'
+ end
else
raise ::Pod::Podfile::Informative, "Unsupported platform: platform must be one of [:ios, :osx]"
end
Something went wrong with that request. Please try again.