Application hangs when profiling with instrument in Xcode 6.0.1

穿精又带淫゛_ 提交于 2019-12-05 19:15:26

问题


I am observing that whenever I am profiling my application using instrument in Xcode 6.0.1, application hangs every time while I am browsing through the application. I am using iPhone 5S (iOS 8.0.2) to run my application. When I run the application on device it runs all fine.


回答1:


Found the fix - disabling the NSLog statements (profiling on release and not on debug) solved the issue for me.




回答2:


Extending on Abhinav's correct answer, NSLog() is indeed triggering the issue, but not all NSLogs, only some very large ones. In my case I was logging some long responses from a web service, and commenting only those ones out fixed the problem of Instruments hanging. I guess this is the reason why the issue is not as widespread as you'd think (I couldn't find any reference to it on Apple's dev forums).




回答3:


I've just been solving the same issue and it turned out to be caused by something else. I'm not 100% sure yet which part of my code is responsible, but it's got something to do with accessing the internet. So I've switched into Airplane mode et voila! So my conclusion is that a network request was hanging the main thread (only when running Instruments tho -- weird) and if anyone else is running into similar problems, try finding what might hang your main thread.

Hope it saves some time :)

Z.




回答4:


Follow those steps:

  1. Run app on your device. It would be better if you set Release build in Edit scheme menu.
  2. Go to the Debug navigator section on your Navigator (left menu in Xcode).
  3. Click on CPU.
  4. Click on Profile in Instruments and choose Transfer.
  5. Instruments will run Time Profiler. Then in top panel click on Library button (looks like "+").
  6. The library menu will open. You need to select your instrument.


来源:https://stackoverflow.com/questions/26390000/application-hangs-when-profiling-with-instrument-in-xcode-6-0-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!