调用 applicationDidFinishLaunching 之前会发生什么?

发布于 2024-09-03 15:49:15 字数 339 浏览 5 评论 0原文

我正在对我的 iPhone 应用程序进行性能测试,我注意到有时在启动时会花费 3-4 秒的时间才能开始看到 applicationDidFinishLaunching 中的 NSLogs。我已经优化了代码进入 applicationDidFinishLaunching 后发生的情况,但我不确定如何优化之前发生的情况。我使用的是 Default.png 初始屏幕,因此它基本上只是在进入 applicationDidFinishLaunching 并开始执行某些操作之前停顿在该屏幕上。

只是为了给你们一些背景信息,我没有 nib 文件,并且我正在使用核心动画,如果这有什么区别的话。我有大约 10 个不同的控制器,我的捆绑包总大小略低于 2MB。

I'm doing performance testing on my iphone app and I'm noticing that sometimes a good 3-4 secs elapse at startup before I start seeing my NSLogs from applicationDidFinishLaunching. I've optimized what happens once the code enters applicationDidFinishLaunching but I'm not sure how to optimize what goes on before that. I'm using a Default.png splash screen so it basically just stalls on that screen before it enters applicationDidFinishLaunching and starts doing something.

Just to give you guys some context, I have no nib files and I'm using core animation, if that makes any difference. I have about 10 different controllers and my total bundle size is just under 2MBs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

固执像三岁 2024-09-10 15:49:15

尝试在不附加调试器的情况下运行它 - 它在启动时所做的事情之一就是等待连接到您的 Mac;)

如果您只是在没有连接 Mac 的设备中运行它,您还会看到延迟吗?

Try running it without the debugger attached - one of the things it does on startup is wait to connect to your mac ;)

If you just run it in the device without your mac connected do you still see the delay?

奶气 2024-09-10 15:49:15

不久前我做了一些实验,发现大多数应用程序的默认启动时间是 3 秒或更长。

令我恼火的是,语音备忘录应用程序需要长达 10 秒的时间才能启动,此时我已经忘记了自己要说什么。我尝试编写一个启动速度更快的程序,通过使用 default.png 并自动开始录制,我得到了一个在 1-1.5 秒内不断启动的录音机。为了获得启动时间,我必须在界面激活之前启动记录器。

然而,在这项研究中,我发现大多数应用程序(例如直接从 Xcode 模板编译而无需修改的应用程序)可在 3-5 秒内启动。

基于这一事实,我想说你确实没有问题。启动时间在预期范围内。 deanWombourne 对调试器的观察很可能是正确的,而且可能使您的启动时间增加一两秒。

I did some experimentation a little while back and found that default start time for most apps is 3 seconds or more.

I was annoyed that the voice memo apps took up to 10 seconds to launch by which time I had forgotten what I was going to say. I tried to write one that would launch faster and by using a default.png and starting the recording automatically I got a recorder that constantly launched in 1-1.5 seconds. To get that launch time, I had to start the recorder before the interface became active.

However, in this research I found that most apps e.g. an app compiled straight from an Xcode template without modifications, launched in 3-5 seconds.

Based on that fact, I would say you really don't have a problem. The startup time falls in the expected range. deanWombourne's observation about the debugger is most likely correct and it probably adds a second or two to your startup time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文