[英]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.您好,我正在开发一个旧的 Objective-C 项目,该项目有 30 多个 pod 依赖项,全部都是用 Objective-C 编写的。
I'm trying to add a Swift pod, this one in particular :我正在尝试添加一个 Swift pod,特别是这个:
pod 'CSV.swift', '~> 2.4.3'
# ...
# other Objective-C pods ...
# ...
Because I would like to continue new developments in Swift.因为我想继续 Swift 的新发展。
But I cannot make it work.但我无法让它发挥作用。 If I add
use_frameworks!
如果我添加
use_frameworks!
, I get an error at pod install : ,我在 pod install 时遇到错误:
The 'Pods-myProject' target has transitive dependencies that include static binaries: (/myProjectPath/Pods/ObjcPod/ObjcPod.framework)
And if I remove use_frameworks!
如果我删除
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.这样你就可以在objective c 项目中使用swift pod 试试这个解决方案。
Write in your pod file写入您的 pod 文件
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.然后运行 Pod 安装。
For import write this对于导入写这个
@import CSV;
And then you have access of your CSV pod files.然后您就可以访问您的 CSV pod 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.