Cocoapods: NoMethodError - undefined method `swift_version=' for

Created on 6 Jul 2016  路  9Comments  路  Source: CocoaPods/CocoaPods

What did you do?

bundle exec pod install

What did you expect to happen?

Install all pod dependencies correctly.

What happened instead?

Error

NoMethodError - undefined method `swift_version=' for #<Pod::Podfile::TargetDefinition label=Pods-Goyava>
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer/target_inspector.rb:47:in `compute_results'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:763:in `block (3 levels) in inspect_targets_to_integrate'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:760:in `each'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:760:in `block (2 levels) in inspect_targets_to_integrate'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:758:in `each'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:758:in `block in inspect_targets_to_integrate'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/user_interface.rb:63:in `section'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:753:in `inspect_targets_to_integrate'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/analyzer.rb:66:in `analyze'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:234:in `analyze'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:148:in `block in resolve_dependencies'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/user_interface.rb:63:in `section'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:147:in `resolve_dependencies'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:111:in `install!'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/command/install.rb:37:in `run'
/Users/Michelin/.rvm/gems/ruby-2.3.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/command.rb:50:in `run'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/bin/pod:55:in `<top (required)>'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/pod:22:in `load'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/pod:22:in `<main>'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

CocoaPods Environment

platform :ios, '9.0'
use_frameworks!

target 'Goyava' do
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'LookbackSafe', :configurations => ['Release']
    pod 'RealmSwift'
    pod 'Reachability'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

Most helpful comment

I use the following Gemfile to get CocoaPods to work properly with Xcode 8.

source "https://rubygems.org"

gem "cocoapods", :git => 'https://github.com/CocoaPods/CocoaPods.git'
gem "xcodeproj", :git => 'https://github.com/CocoaPods/Xcodeproj.git'
gem 'cocoapods-downloader', :git => 'https://github.com/CocoaPods/cocoapods-downloader.git'
gem 'cocoapods-core', :git => 'https://github.com/CocoaPods/Core.git'

All 9 comments

@bolom It looks like you're using CocoaPods Master but not doing the same for Core?
Could you try adding gem 'cocoapods-core', { :git => 'https://github.com/CocoaPods/Core.git', :branch => 'master' } to your Gemfile and try again?

@DanToml yes i am using the master version bc with the code version i have got this error
capture d ecran 30

I use the following Gemfile to get CocoaPods to work properly with Xcode 8.

source "https://rubygems.org"

gem "cocoapods", :git => 'https://github.com/CocoaPods/CocoaPods.git'
gem "xcodeproj", :git => 'https://github.com/CocoaPods/Xcodeproj.git'
gem 'cocoapods-downloader', :git => 'https://github.com/CocoaPods/cocoapods-downloader.git'
gem 'cocoapods-core', :git => 'https://github.com/CocoaPods/Core.git'

this Gemfile i have got this error

target 'Goyava' do
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'AWSMobileAnalytics'
    pod 'LookbackSafe', :configurations => ['Release']
    pod 'RealmSwift'
    pod 'Reachability'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

Error

NoMethodError - undefined method `try' for <Pod::PodTarget name=RealmSwift >:Pod::PodTarget
Did you mean?  trap
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb:287:in `add_language_specific_settings'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb:228:in `add_target_specific_settings'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb:65:in `generate'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb:35:in `save_as'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:211:in `create_xcconfig_file'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:24:in `block in install!'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/user_interface.rb:141:in `message'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:19:in `install!'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator.rb:155:in `block (2 levels) in install_libraries'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator.rb:153:in `each'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator.rb:153:in `block in install_libraries'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/user_interface.rb:141:in `message'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator.rb:152:in `install_libraries'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer/xcode/pods_project_generator.rb:64:in `generate!'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:177:in `block in generate_pods_project'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/user_interface.rb:63:in `section'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:176:in `generate_pods_project'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/installer.rb:116:in `install!'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/command/install.rb:37:in `run'
/Users/Michelin/.rvm/gems/ruby-2.3.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/lib/cocoapods/command.rb:50:in `run'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bundler/gems/CocoaPods-4fdb40b0b138/bin/pod:55:in `<top (required)>'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/pod:22:in `load'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/pod:22:in `<main>'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/Michelin/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

huh. IIRC try is defined as part of active_support, so that could be active_support/core_ext/object/try not being required maybe? c @segiddins

Yeah, I just managed to reproduce this locally (interestingly specs don't catch this one). Will push up a PR now.

You can also gem install beta-pod && beta-pod master install if you're into using wacky things created by segiddins

working for me guys tks!

Was this page helpful?
0 / 5 - 0 ratings