Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `empty?' for nil:NilClass at target_validator.rb:118 when changing swift_versions in pre_install step #9745

Closed
1 task done
acecilia opened this issue Apr 23, 2020 · 1 comment · Fixed by #9748
Labels
s2:confirmed Issues that have been confirmed by a CocoaPods contributor t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!
Milestone

Comments

@acecilia
Copy link

acecilia commented Apr 23, 2020

Report

What did you do?

Got the following Podfile:

use_frameworks!
platform :ios, '11.0'

pod 'InputMask', '4.2.0'

pre_install do |installer|
  installer.analysis_result.specifications.each do |s|
    s.root.swift_versions << '4.2' if s.root.swift_versions.empty?
  end
end

What did you expect to happen?

pod install does not crash

What happened instead?

pod install crashed with:

NoMethodError - undefined method `empty?' for nil:NilClass
/Users/user/Desktop/vendor/bundle/ruby/2.6.0/bundler/gems/Cocoapods-2b774aa58f1e/lib/cocoapods/installer/xcode/target_validator.rb:118:in `block in verify_swift_pods_swift_version'

CocoaPods Environment

Tested with cocoapods versions:

  • 1.8.4: not crashing
  • 1.9.1: crashing
  • latest on master at the time of writing: crashing

Catalina 10.15.4, Xcode 11.3.1.

Project that demonstrates the issue

Just run pod install in the Podfile I shown above.

Looks similar issue than the one explained in #9688

@dnkoutso
Copy link
Contributor

Its because the Podfile has no target declaration. Not super related I dont think to #9688.

@dnkoutso dnkoutso added s1:awaiting input Waiting for input from the original author t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome! s2:confirmed Issues that have been confirmed by a CocoaPods contributor and removed s1:awaiting input Waiting for input from the original author labels Apr 24, 2020
@dnkoutso dnkoutso added this to the 1.10.0 milestone Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s2:confirmed Issues that have been confirmed by a CocoaPods contributor t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants