Search code examples
iosobjective-cxcodecocoapodsxcode-tools

CocoaPods and newer (iOS 8) APIs?


I've got a library that I'm trying to push to CocoaPods trunk, but it won't lint against the iOS 7 SDK, because it contains iOS 8 API calls.

Changing the podspec's version to 8.0 does nothing, and the linter tries to build against 7.1, which fails. How can I change the cocoapods linter to lint against iOS 8 beta?

Edit

I run the pod trunk push my.podspec command with the --verbose option and see this in the log:

=== BUILD TARGET Pods-MBPlacePickerController OF PROJECT Pods WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies iOS deployment target '8.0' for architecture 'arm64' and variant 'normal' is greater than > the maximum value '7.1.99' for the iOS 7.1 SDK.

Here's my podspec:

Pod::Spec.new do |s|

  s.name         = "MBPlacePickerController"
  s.version      = "2.2.2"
  s.summary      = "An open source place picker for iOS."
  s.description  = <<-DESC
    A view controller for picking a location. I wrote it to be a simple wrapper around automatic location detection, but also to offer manual location selection in case GPS isn't available.
                   DESC
  s.homepage     = "https://github.com/MosheBerman/MBPlacePickerController"
  s.screenshots  = "https://raw.github.com/MosheBerman/MBPlacePickerController/master/screens/2.2.0/Readme/Default-Dark.png"
  s.author       = { "Moshe Berman" => "[email protected]" }
  s.license      = 'MIT'
  s.platform     = :ios, '8.0'
  s.source       = { :git => "https://github.com/MosheBerman/MBPlacePickerController.git", :tag => "2.2.2"} 
  s.source_files  = 'Classes', 'MBPlacePickerController/MBPlacePickerController/**/*.{h,m}'
  s.frameworks = 'QuartzCore'
  s.weak_framework = 'CoreLocation'
  s.requires_arc = true
end

Solution

  • You will want to include the following line in the pod spec:

    s.platform = :ios, '8.0'
    

    8.0 refers to the deployment target, so only if the deployment target is iOS 8.0 can other developers use your library through CocoaPods.

    Also, since iOS 8.0 is still in beta and Xcode 6 is therefore too, you will want to run the following command:

    sudo xcode-select --switch /Applications/Xcode6-Beta5.app/Contents/Developer