Can ipa file be created in debug mode?

别来无恙 提交于 2019-12-05 16:31:19

问题


Two questions on ipa files.

  • 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?

My environment Xcode 4.6 and iOS 5 & 6.


回答1:


About the first question, yes, you can archive an app in Debug mode. From Xcode, browse the Product menu, Scheme, Manage Schemes, Edit. Select the Archive action on the left pane and choose Debug as Build Configuration in the drop down box.

If you want to restrict logging only to Debug configurations, you can add this to your ProjectName-Prefix.pch file:

#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).

Then you must use XYZLog instead of NSLog in your code and the output will only go to the console for Debug versions.




回答2:


So to create a debuggable IPA, you will need to Archive it and save for Ad-Hoc or Enterprise.

As far as logging to the console in this ad-hoc build, there are several ways to do this, see this answer.



来源:https://stackoverflow.com/questions/17282655/can-ipa-file-be-created-in-debug-mode

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