简体   繁体   English

如何在Xcode中调试间歇性缓慢的iOS iPhone应用程序加载时间?

[英]How to debug intermittent slow iOS iPhone app load times in Xcode?

I have an iOS Xcode project that previously would load fast, but from time to time, now will hang for five seconds or more during loading. 我有一个iOS Xcode项目,该项目以前会快速加载,但现在会不时地在加载过程中挂起五秒钟或更长时间。 When the app is run on an iPhone, the launch screen displays instantly, but sometimes, not always, and unpredictably, the app just hangs for around 5 seconds or more until the actual interface is displayed. 当该应用程序在iPhone上运行时,启动屏幕会立即显示,但有时(并非总是如此)且无法预测,该应用程序会挂起5秒钟或更长时间,直到显示实际界面为止。 It occurs both on the simulator and device across different iOS versions 7, 8, 9. 它在不同的iOS版本7、8、9的模拟器和设备上均发生。

Recently, a UIView's class that contains a drawRect function was changed slightly, it has an outlet connection to one of the ViewControllers, but no significant changes made overall. 最近,一个包含drawRect函数的UIView的类进行了一些更改,它与一个ViewController的出口连接,但是总体上没有进行重大更改。 One ViewController has code in the ViewDidLoad, ViewWillAppear, ViewDidAppear functions. 一个ViewController在ViewDidLoad,ViewWillAppear,ViewDidAppear函数中具有代码。 All these things I'm investigating if they are impacting the load time. 我正在调查所有这些事情是否会影响加载时间。

When I terminate the app, the next time I try running it, it loads super fast without issue. 当我终止该应用程序时,下次尝试运行该应用程序时,它加载速度非常快,没有问题。 I have no idea what to make of this load behaviour. 我不知道该如何处理这种负载行为。

Questions 问题

1 - What methods can I use in Xcode to debug an app that loads slowly at irregular and unpredictable times? 1-我可以在Xcode中使用哪些方法来调试在不规则且不可预测的时间缓慢加载的应用程序?

2 - What obvious items should I be on the look out in the project that typically cause slow or prolonged load times? 2-我应该在项目中查找哪些明显的项目,这些项目通常会导致加载时间缓慢或延长?

3 - Does Xcode include tools to monitor the processes operating live while loading occurs? 3-Xcode是否包含工具来监视加载发生时实时运行的进程?

4 - Is it possible to print output for load processes I can review? 4-是否可以打印我可以查看的加载过程的输出?

Any experienced advice really appreciated. 任何有经验的建议都非常感谢。 Thanks. 谢谢。

Not sure if you have looked instrumentation. 不知道您是否看过仪器。 It is the best way to determine this kind of issues with your app. 这是确定应用程序中此类问题的最佳方法。

https://developer.apple.com/library/watchos/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/index.html https://developer.apple.com/library/watchos/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/index.html

When I terminate the app, the next time I try running it, it loads super fast without issue. 当我终止该应用程序时,下次尝试运行该应用程序时,它加载速度非常快,没有问题。 I have no idea what to make of this load behavior. 我不知道该如何处理这种负载行为。

Do you mean exiting the app? 您是要退出应用吗? Or actually killing it? 还是实际上杀死了它? Cause if it is the former, then the reason is the app was just launched from a suspended state. 原因如果是前者,则原因是该应用程序刚刚从暂停状态启动。

I would suggest take a closer look at didFinishLaunchingWithOptions: , and check if you are doing something that takes more time than needed. 我建议仔细看一下didFinishLaunchingWithOptions:并检查您是否在做比所需时间更多的事情。 Run your app with the time profiler instrument, it will tell you where is your bottleneck. 使用时间分析器工具运行您的应用程序,它将告诉您瓶颈在哪里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ios 缓慢的应用程序加载时间 - ios slow app load times 如何使用Xcode 6在iPhone 4上部署和调试iOS应用 - how to deploy and debug an iOS app on iPhone 4 using Xcode 6 如何使用XCode 5在iOS7上调试Cordova应用 - How to debug an cordova app on iOS7 with XCode 5 使用XCode for iOS的编译/运行时间非常慢 - Very slow compile / run times with XCode for iOS 为最新的 iPhone 构建 Xcode iOS 应用程序(如何在不更新 Xcode 的情况下使 Xcode 部署到最新的 iOS?) - Xcode iOS app build for newest iPhone (How to make Xcode to deploy to the very latest iOS without updating Xcode?) 如何在没有Xcode的设备上的命令行上使用lldb调试iOS应用程序 - How to debug an iOS app with lldb on the command line on a device without Xcode 断开连接时如何在 iPhone 上使用 iOS 调试应用程序? - How to use iOS debug app on iPhone while disconnected? 如何调试在Xcode上未启动的移动设备中执行的iOS应用程序? - How can I debug an iOS app executed in mobile not launched by Xcode? 如何在Xcode 7或更高版本中将我的iOS App从iPhone转换为通用? - How to convert my iOS App from iPhone to universal in Xcode 7 or later? 如何从Xcode 3.2为iPhone 5支持准备iOS 4.2应用程序? - How to prepare iOS 4.2 app from Xcode 3.2 for iPhone 5 support?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM