How to remove certain frameworks and code from an App Store release build?

旧时模样 提交于 2019-12-11 19:19:15

问题


I have an app that uses TestFlight SDK and other debugging frameworks which I want to remove automatically for App Store release builds.

I created a new "App Store" build configuration, but how can I teach Xcode which frameworks I want to be included with this build? And how can I make the code that uses these frameworks conditional so it is excluded from the App Store release build?


回答1:


You have three components of the process that work in your favor, to remove extraneous code.

First, you have the preprocessor. If you wrap your TestFlight import and code with #if DEBUG statements, then you will be fine. The #if statement is designed so that the preprocessor will strip out extra statements that you don't need. It won't make it to the compiler.

Second, the compiler is there for you. The compiler is smart about stripping dead code from release builds. If you write code and don't use it, it won't make it into the final binary, even if it passes the preprocessor.

Third, if you're really concerned about those frameworks making it into your release builds, you can make an extra target in Xcode, and change the linker options for that target. This isn't necessary, but the option is there for you if you'd like. This is the closest to your "explicit exclusion".

Honestly, though, trust your compiler and linker, unless they give you reason not to.



来源:https://stackoverflow.com/questions/16921529/how-to-remove-certain-frameworks-and-code-from-an-app-store-release-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!