iOS开发:Instruments、本地化与应用分发指南
1. Instruments中的路标(Signposts)
在iOS 12和Xcode 10中,你可以以路标的形式将自定义消息注入到Instruments图表中。例如,怀疑最高内存峰值出现在 newgame 方法内,可通过添加路标来确认。具体操作如下:
1. 导入 os 库并配置一个名为 mylog 的 OSLog 对象。
2. 使用 os_signpost 调用标记 newgame 方法的开始和结束:
os_signpost(type: .start, log: mylog, name: "newgame", "start")
// ...
os_signpost(type: .end, log: mylog, name: "newgame", "end")
- 准备Instruments模板:
- 从空白模板开始。
- 选择
View → Show Library打开仪器选择器。 - 将
Allocations仪器和os_signpost仪器添加到模板中。
运行应用时,Instrume
超级会员免费看
订阅专栏 解锁全文
8

被折叠的 条评论
为什么被折叠?



