ios 在设备上运行时 NSLog 信息会发生什么变化?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5318342/
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
what happens to NSLog info when running on a device?
提问by Greg
what happens to NSLog info when running on a device? Where does the text go? Does it get saved? Is it therefore a big overhead when running on a device, or does it effectively get sent to null?
在设备上运行时 NSLog 信息会发生什么变化?文本去哪儿了?它得到保存吗?因此,在设备上运行时是否会产生很大的开销,或者它是否有效地被发送到 null?
采纳答案by FreeAsInBeer
Your device will continue logging even when it's not connected to your mac. To see the logs, you need to open Xcode, click the 'Window' menu item, and then 'Organizer'. Then select your device and then select the 'Device Logs' tab. For some reason (for me at least) viewing the logs seems flaky, so if nothing shows up, you may need to completely quit Xcode and restart it.
即使您的设备未连接到您的 Mac,它也会继续记录。要查看日志,您需要打开 Xcode,单击“窗口”菜单项,然后单击“组织器”。然后选择您的设备,然后选择“设备日志”选项卡。出于某种原因(至少对我而言)查看日志似乎很不稳定,因此如果没有任何显示,您可能需要完全退出 Xcode 并重新启动它。
回答by owenfi
Since Xcode 6 the device manager pane has been split into its own window. (Window > Devices, or Command-Shift-2.)
自 Xcode 6 起,设备管理器窗格已拆分为自己的窗口。(窗口 > 设备,或 Command-Shift-2。)
Once there, select your device, then show its log by clicking the disclosure triangle at the bottom of the window to the right of the sidebar.
在那里,选择您的设备,然后通过单击侧边栏右侧窗口底部的显示三角形来显示其日志。
回答by picciano
It gets written to the Console log on the device. You can read it in the "Organizer" within Xcode when your device is connected.
它被写入设备上的控制台日志。当您的设备连接时,您可以在 Xcode 的“管理器”中阅读它。
回答by CupawnTae
The text is logged. You can view the logs in xcode via the (almost-invisible) disclosure triangle in the Devices window as described in another answer.
文本被记录。您可以通过“设备”窗口中的(几乎不可见的)显示三角形查看 xcode 中的日志,如另一个答案中所述。
You can also access the logs in a more usable view (including filtering) by opening Console.app on your connected Mac and selecting the device on the left.
您还可以通过在连接的 Mac 上打开 Console.app 并选择左侧的设备,以更实用的视图(包括过滤)访问日志。
There will be someoverhead with logging, but considering the volume of logging that's going on all the time in recent versions of iOS, unless you're generating an awful lot of output (or spending time generating the messages), it's unlikely to be significant.
日志记录会有一些开销,但考虑到最近版本的 iOS 中一直在进行的日志记录量,除非您生成大量输出(或花费时间生成消息),否则它不太可能很重要.
回答by JFoulkes
It gets logged out. You can retrieve it by connecting the device and looking in the organizing in xcode
它被注销。您可以通过连接设备并在 xcode 中查看组织来检索它