获取iOS中解析期间操作之间的时间间隔
我正在解析 xml,我想知道如何跟踪执行相同操作所需的时间。
我尝试使用警报,但由于弹出大量警报,它一直使我的应用程序崩溃。
如果我尝试通过 XCODE 在 iPAD 上运行我的项目(即选择目标作为我的 iPAD),以及如果我尝试在 iPAD 未连接到 Mac 时运行该项目,情况是否相同?我问这个是因为,当我尝试 NSLogging 时,它会出现在 Xcode 上。但我觉得这样是不是不对。
I am parsing an xml and I would like to know how I can keep track of the time it takes to do the same.
I tried to use alerts, but it kept crashing my app due to the large number of alert popping up.
Is it the same if I try to run my project on my iPAD through XCODE (i.e. by selecting target as my iPAD) and if I try to run the project when the iPAD is not connected to the mac? I ask this because, when I try NSLogging the times, it comes out on the Xcode. But I feel that is it not right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSLog 应该在 XCode 中显示。它将日志消息打印到系统日志中,而在 iPad 上,您无法在设备本身上看到该消息。
如果是我,我会这样做:
在解码 XML 之前存储一个 NSDate 变量(可能作为属性,因为您很可能异步进行 XML 解码)
然后,当 XML 完成解码时:
将打印输出解码所花费的时间(以秒为单位)。
NSLog is supposed to show in XCode. It prints a log message to the system log, which, on the iPad you have no way of seeing on the device itself.
If it were me, I'd do something like this:
Store an NSDate variable before decoding the XML (probably as a property, since you're most likely doing XML decoding asynchronously)
Then, when the XML has finished decoding:
That will print out the amount of time spent decoding in seconds.
您可以使用 NSLog 并在未连接到 XCode 机器时运行它。之后,您可以将其连接到 XCode 并读取断开连接时所做的控制台条目。只需转到管理器并选择您设备的控制台即可。
编辑:您还可以通过从 App Store 安装控制台应用程序来查看设备本身上的 NSlog 条目。
You can use NSLog and run it while not connected to your XCode machine. Afterwards, y0u can connect it to XCode and read the console entries made while it was disconnected. Just go to the organizer and select your device's console.
edit: You can also see the NSlog entries on the device itself by installing the Console app from the App Store.