xcode 可以在调试模式下创建 ipa 文件吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17282655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can ipa file be created in debug mode?
提问by Rocky
Two questions on ipa files.
关于ipa文件的两个问题。
- Can ipa file be created in debug mode? If so, how do you archive the file in debug mode?
- Our ipa file, after installed to a device, is outputting our logs to the console. Can we disable logging functionality to the console?
- 可以在调试模式下创建 ipa 文件吗?如果是这样,您如何在调试模式下存档文件?
- 我们的 ipa 文件在安装到设备后,将我们的日志输出到控制台。我们可以禁用控制台的日志记录功能吗?
My environment Xcode 4.6 and iOS 5 & 6.
我的环境 Xcode 4.6 和 iOS 5 & 6。
回答by Daniel Martín
About the first question, yes, you can archive an app in Debug mode. From Xcode, browse the Productmenu, Scheme, Manage Schemes, Edit. Select the Archiveaction on the left pane and choose Debugas Build Configuration in the drop down box.
关于第一个问题,是的,您可以在调试模式下存档应用程序。在 Xcode 中,浏览Product菜单、Scheme、Manage Schemes、Edit。在左窗格中选择存档操作,然后在下拉框中选择调试作为构建配置。
If you want to restrict logging only to Debug configurations, you can add this to your ProjectName-Prefix.pch
file:
如果您只想将日志记录限制为调试配置,您可以将其添加到您的ProjectName-Prefix.pch
文件中:
#ifdef DEBUG
#define XYZLog(format, ...) NSLog(format, ## __VA_ARGS__)
#else
#define XYZLog(format, ...)
#endif
Where "XYZ" is the three letter prefix for your application (Cocoa naming convention).
其中“XYZ”是您的应用程序的三个字母前缀(Cocoa 命名约定)。
Then you must use XYZLog
instead of NSLog
in your code and the output will only go to the console for Debug versions.
然后你必须在你的代码中使用XYZLog
而不是,NSLog
输出只会进入调试版本的控制台。
回答by WrightsCS
So to create a debuggable IPA, you will need to Archive it and save for Ad-Hoc or Enterprise.
因此,要创建可调试的 IPA,您需要将其存档并保存以供 Ad-Hoc 或 Enterprise 使用。
As far as logging to the console in this ad-hoc build, there are several ways to do this, see this answer.
至于在此临时构建中登录到控制台,有几种方法可以做到这一点,请参阅此答案。