Open bpoplauschi opened 5 years ago
I don think that is related with this project.
I encountered the same problem. Downgrading to 1.5.3 consistently solves the issue for me.
@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
Getting the same error with Cocoapods 1.6.1, downgrading to 1.5.3 also solved the issue for me.
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.
Same issue happens with CocoaPods 1.7.0.rc.1
I was hoping CocoaPods 1.7.0
would fix this issue. Maybe the issue should be posted to the CocoaPods project?
Is there any workaround?
Only thing that worked for me is using CocoaPods 1.5.3
, which does not work with XCode 10.2.
Has someone tried this on Cocoapods 1.7.0.rc.2
Can confirm pre_compile
hooks are not working on Cocoapods 1.7.0.rc.2
either.
😞
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.
I’ve also found that the pre release version of Alamofire works. It includes the Swift version.
Very nice @Unknoob - appreciate your solution
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
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?
Update for CocoaPods 1.9.1:
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 failstarget '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 https://github.com/CocoaPods/CocoaPods/issues/9799
Report
What did you do?
pod install
on an empty folder with just thisPodfile
plugin 'cocoapods-rome'
target 'caesar' do pod 'Alamofire' end
CocoaPods : 1.6.0.beta.2 Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin17] RubyGems : 2.7.7 Host : Mac OS X 10.13.6 Xcode : Version 10.0 (10A255) Git : git version 2.17.1 (Apple Git-112) Ruby lib dir : Repositories : master - https://github.com/CocoaPods/Specs.git @ 3b87cd44ee362bf10ba1b86e622b3bb219ef5c94
cocoapods (1.6.0.beta.2, 1.6.0.beta.1, 1.5.3) cocoapods-core (1.6.0.beta.2, 1.6.0.beta.1, 1.5.3) cocoapods-deintegrate (1.0.2) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) cocoapods-rome (1.0.1) cocoapods-search (1.0.0) cocoapods-stats (1.0.0) cocoapods-trunk (1.3.1) cocoapods-try (1.1.0)
Error