Code Monkey home page Code Monkey logo

Comments (17)

Unknoob avatar Unknoob commented on June 5, 2024 4

I opened an issue on the Cocoapods repo and dnkoutso helped me find a fix. 🎉

Just add this to your Podfile:

pre_install do |installer|
    installer.analysis_result.specifications.each do |s|
      s.swift_version = '4.2' 
    end
end

It will modify the spec earlier and the compilation will work.

from rome.

jlnr avatar jlnr commented on June 5, 2024 4

With CocoaPods 1.7.1, I had to update the workaround to use the new pluralized swift_versions attribute:

s.swift_versions << '4.2' if s.swift_versions.empty?

from rome.

bpoplauschi avatar bpoplauschi commented on June 5, 2024 2

Update for CocoaPods 1.9.1:

  • setting either s.swift_version or s.swift_versions doesn't entirely do the job, as apparently both will affect the value of the swift_versions array, but swift_version remains nil and fails
  • the only solution I could find was to use
target 'XXX' do
  current_target_definition.swift_version = '5.0'
end

That current_target_definition.swift_version gets picked up and set as the Swift version for those pods that are missing the swift_version.
I no longer need the pre_install hook.
See CocoaPods/CocoaPods#9799

from rome.

bpoplauschi avatar bpoplauschi commented on June 5, 2024 1

Same issue happens with CocoaPods 1.7.0.rc.1

from rome.

Unknoob avatar Unknoob commented on June 5, 2024 1

Only thing that worked for me is using CocoaPods 1.5.3, which does not work with XCode 10.2.

from rome.

dnkoutso avatar dnkoutso commented on June 5, 2024

I don think that is related with this project.

from rome.

Thomvis avatar Thomvis commented on June 5, 2024

I encountered the same problem. Downgrading to 1.5.3 consistently solves the issue for me.

from rome.

bpoplauschi avatar bpoplauschi commented on June 5, 2024

@Thomvis same for me.
I never got a response back from the CP team on this issue. Maybe it's related to @dnkoutso 's comment. Why do you think it's not related to this project? I described a clear scenario where the plugin doesn't function correctly with CocoaPods 1.6.0.beta.2

from rome.

Unknoob avatar Unknoob commented on June 5, 2024

Getting the same error with Cocoapods 1.6.1, downgrading to 1.5.3 also solved the issue for me.

from rome.

dirkoswanepoel avatar dirkoswanepoel commented on June 5, 2024

Unfortunately the Xcode 10.2 simulators don't work with cocoapods 1.5.3 for me. The version of fourflusher used in cocoapods 1.5.3 doesn't support xcode 10.2. And I also get the same "Alamofire does not specify a Swift version and none of the targets" error with cocoapods 1.6.1.

from rome.

Unknoob avatar Unknoob commented on June 5, 2024

I was hoping CocoaPods 1.7.0 would fix this issue. Maybe the issue should be posted to the CocoaPods project?

from rome.

dirkoswanepoel avatar dirkoswanepoel commented on June 5, 2024

Is there any workaround?

from rome.

dirkoswanepoel avatar dirkoswanepoel commented on June 5, 2024

Has someone tried this on Cocoapods 1.7.0.rc.2

from rome.

Unknoob avatar Unknoob commented on June 5, 2024

Can confirm pre_compile hooks are not working on Cocoapods 1.7.0.rc.2 either.
😞

from rome.

dirkoswanepoel avatar dirkoswanepoel commented on June 5, 2024

I’ve also found that the pre release version of Alamofire works. It includes the Swift version.

from rome.

bpoplauschi avatar bpoplauschi commented on June 5, 2024

Very nice @Unknoob - appreciate your solution

from rome.

bpoplauschi avatar bpoplauschi commented on June 5, 2024

Update and weird case: if anyone still sees the error after applying the fix above

[!] Unable to determine Swift version for the following pods:

- `POD_XXX` does not specify a Swift version and none of the targets (`targetname`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

it might be because they are only explicitly picking subspecs from a pod in their Podfile and this leads to installer.analysis_result.specifications not containing the target for the Pod.

Example

pod 'OHHTTPStubs/Swift', version
pod 'OHHTTPStubs/HTTPMessage', version
pod 'OHHTTPStubs/Mocktail', version

and the simple fix is just explicitly adding the pod without any subspec

pod 'OHHTTPStubs', version

from rome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.