简体   繁体   English

在构建时添加框架-XCode

[英]Adding framework at build time - XCode

I have a project where I want to add in a framework only if required. 我有一个项目,仅在需要时才想添加到框架中。 This is to be done at build time. 这将在构建时完成。 The framework library size will affect the app's size. 框架库的大小将影响应用程序的大小。 Is there a way I can add the framework at build time? 有什么方法可以在构建时添加框架吗? I'm trying to use the xconfig file to define the preprocessor macro and if that macro is defined I should want to add the framework, else ignore. 我正在尝试使用xconfig文件定义预处理器宏,如果定义了该宏,则应该添加框架,否则将忽略。 Any suggestion on that? 有什么建议吗?

Update: I'm building the project using a script file. 更新:我正在使用脚本文件构建项目。 The project has a .xcconfig file which holds the value for the preprocessor. 该项目有一个.xcconfig文件,其中包含预处理器的值。 When the script finds the preprocessor value not empty it adds the framework to the build. 当脚本发现预处理器值不为空时,它将框架添加到构建中。

Lookup @import versus #import 查找@import与#import

@import will link the framework as needed. @import将根据需要链接框架。

See - @import vs #import - iOS 7 参见-@ import vs #import-iOS 7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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