本文介绍了os_signpost在模拟器上有效,但在设备上运行时无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在我要使用仪器跟踪时间的功能之一中,有以下代码行.当我通过仪器在模拟器上运行该应用程序时,使用os_signpost的测量时间就会显示出来,并且我可以准确地测量出我需要的东西.

I have the following lines of code in one of the functions I want to track time for, using instruments. When I run the app on simulator from instruments, the measured times with os_signpost do show up and I can accurately measure what I need.

然后我切换到设备,输入相同的代码.但是,由于它在设备上运行,因此不会显示测量的时间.它只显示以下内容:

Then I switch to device, same code. However, as it runs on device instruments does not show the measured times. It only show this:

os_signpost时间根本不显示.

the os_signpost times do not show up at all.

因此,所有功能都可以在模拟器上很好地工作,但是当我切换到iPhone设备时却不能.

So, all works great on simulator, but not when I switch to my iPhone device.

有什么主意吗?

let spid = OSSignpostID(log: SignpostLog.myLog, object: myObj as AnyObject)

defer { os_signpost(.end, log: SignpostLog.myLog, name: "operation1", signpostID: spid) }

os_signpost(.begin, log: SignpostLog.myLog, name: "operation1", signpostID: spid)

推荐答案

确保未通过环境变量禁用OS_ACTIVITY_MODE(请参见下面的屏幕截图)

Make sure you did not disable OS_ACTIVITY_MODE via an environment variable (see screenshot below)

我删除了它,一切正常=)

I removed it and everything worked =)

这篇关于os_signpost在模拟器上有效,但在设备上运行时无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:12