gpt4 book ai didi

ios - 我们为什么要使用use_frameworks!在 CocoaPods 中?

转载 作者:IT王子 更新时间:2023-10-29 07:33:25 26 4
gpt4 key购买 nike

我在 CocoaPods Podfile 中多次使用 use_frameworks! 。我只是想知道我们为什么要使用它?我无法得到直接的答案。

例子:

platform :ios, '8.0'
use_frameworks!

target "CityWhether" do
pod 'Alamofire'
pod 'SwiftyJSON'
end

最佳答案

use_frameworks! 告诉 CocoaPods 您想要使用框架而不是静态库。由于 Swift 不支持静态库,因此您必须使用框架。


在另一个回答中,我解释了静态库和框架之间的区别:

Cocoa Touch Frameworks

They are always open-source and will be built just like your app. (SoXcode will sometimes compile it, when you run your app and alwaysafter you cleaned the project.) Frameworks only support iOS 8 andnewer, but you can use Swift and Objective-C in the framework.

Cocoa Touch Static Libraries

As the name says, they are static. So they are already compiled, whenyou import them to your project. You can share them with otherswithout showing them your code. Note that Static Libraries currentlydon't support Swift. You will have to use Objective-C within thelibrary. The app itself can still be written in Swift.

来源:My other answer | AddThis.com Blog

关于ios - 我们为什么要使用use_frameworks!在 CocoaPods 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41210249/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com