简体   繁体   中英

iOS - Add Swift pod to Objective-C project

Hello I'm working on an old Objective-C project, that has 30+ pods dependecies, all written in Objective-C.

I'm trying to add a Swift pod, this one in particular :

pod 'CSV.swift', '~> 2.4.3'
# ...
# other Objective-C pods ...
# ...

Because I would like to continue new developments in Swift.

But I cannot make it work. If I add use_frameworks! , I get an error at pod install :

The 'Pods-myProject' target has transitive dependencies that include static binaries: (/myProjectPath/Pods/ObjcPod/ObjcPod.framework)

And if I remove use_frameworks! , I get tons of compilation errors, here are some :

Undefined symbol: protocol descriptor for Swift.UnicodeCodec
Undefined symbol: dispatch thunk of Swift.UnicodeCodec.decode<A where A1: Swift.IteratorProtocol, A.CodeUnit == A1.Element>(inout A1) -> Swift.UnicodeDecodingResult

I don't know what I could try otherwise, any help would be much appreciated !

This way you can use swift pod in objective c project try this solution.

Write in your pod file

target 'YourProjectName' do
use_frameworks!

pod 'CSV.swift', '~> 2.4.3'
// Here you can add mode pod as per your requirement Like
pod 'Firebase/Core'
pod 'Fabric'
pod 'Crashlytics'

end

Then Run Pod Install.

For import write this

@import CSV;

And then you have access of your CSV pod files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM