如何在iOS应用程序中将Objective-C和Swift pod集成到同一个项目中 [英] How to integrate both Objective-C and Swift pods in same project in iOS app

查看:95
本文介绍了如何在iOS应用程序中将Objective-C和Swift pod集成到同一个项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iOS应用中做Objective-C。但问题是我想添加几个Objective-C apis,我之前已成功添加了可可豆荚,但是,现在我想通过可可豆荚添加Swift Api,但是安装时遇到的问题是:

I am doing Objective-C in iOS app. But the problem is I want to add few Objective-C apis into that I added successfully earlier with cocoa pods, But, now I want to add Swift Api through cocoa pods, but the problem getting while installing is following.

[!]用Swift编写的Pod只能作为框架集成;将 use_frameworks!添加到您的Podfile或目标以选择使用它。正在使用的Swift Pod是:apis

[!] Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: apis

但是我不能手动添加它,因为它的api很大而且包含子文件夹。

But I can't add this manually due to its large api and it contains sub folders.

但是,如果我从use_frameworks中删除#键,它就会被安装,但是,在我的项目中找不到旧的Objective-C apis获取文件。
即使我对通过可可豆荚安装框架/ apis有非常基本的了解。

But, if I remove "#" key from use_frameworks!, its getting installed, but, the old Objective-C apis getting file not found in my project. Even I have very basic knowledge at installing frameworks/apis through cocoa pods.

任何人都可以建议我如何克服这个问题。

Can any one suggest me how to over come this.

推荐答案

use_frameworks!适用于 Objective-C pod如果它们是动态框架而不是静态库。大多数流行的第三方库都使用动态框架,如 AFNetworking GoogleMaps 等。

use_frameworks! will work with Objective-C pod only if they are dynamic frameworks not static libraries. Most of the popular third party libraries are using dynamic frameworks like AFNetworking, GoogleMaps etc.

确保所有 Objective-C pod都是动态框架。如果您不确定只使用 cocoapods 创建示例项目并使用 use_frameworks!。尝试逐个添加,所有的pod并找出哪一个是罪魁祸首。

Make sure all your Objective-C pods are dynamic frameworks. If you are not sure just create a sample project with cocoapods and use use_frameworks!. Try adding one by one, all the pods and find out which one is the culprit.

这篇关于如何在iOS应用程序中将Objective-C和Swift pod集成到同一个项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆