Why do we use use_frameworks! in CocoaPods?(为什么我们使用 use_frameworks!在 CocoaPods 中?)
问题描述
我在CocoaPods Podfile
中使用过use_frameworks!
很多次.我只是想知道我们为什么要使用它?我无法得到直截了当的答案.
I have used use_frameworks!
in CocoaPods Podfile
many times. I just wonder why do we use it? I couldn't get the straight forward answer of it.
例子:
platform :ios, '8.0'
use_frameworks!
target "CityWhether" do
pod 'Alamofire'
pod 'SwiftyJSON'
end
推荐答案
use_frameworks!
告诉 CocoaPods 你想使用框架而不是静态库.由于 Swift 不支持静态库,因此您必须使用框架.
use_frameworks!
tells CocoaPods that you want to use Frameworks instead of Static Libraries. Since Swift does not support Static Libraries you have to use frameworks.
在另一个答案中,我解释了静态库和框架之间的区别:
In another answer, I explained the differences between Static Libraries and Frameworks:
它们始终是开源的,并且将像您的应用一样构建.(所以Xcode 有时会编译它,当你运行你的应用程序并且总是清理项目后.)框架仅支持 iOS 8 和较新,但您可以在框架中使用 Swift 和 Objective-C.
Cocoa Touch Frameworks
They are always open-source and will be built just like your app. (So Xcode will sometimes compile it, when you run your app and always after you cleaned the project.) Frameworks only support iOS 8 and newer, but you can use Swift and Objective-C in the framework.
顾名思义,它们是静态的.所以他们已经编译了,当您将它们导入您的项目.您可以与他人分享没有向他们展示你的代码.请注意,目前静态库不支持斯威夫特.您必须在图书馆.应用程序本身仍然可以用 Swift 编写.
As the name says, they are static. So they are already compiled, when you import them to your project. You can share them with others without showing them your code. Note that Static Libraries currently don't support Swift. You will have to use Objective-C within the library. The app itself can still be written in Swift.
来源:我的其他答案 |AddThis.com 博客
这篇关于为什么我们使用 use_frameworks!在 CocoaPods 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么我们使用 use_frameworks!在 CocoaPods 中?


- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01