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. Anyone faced the similar issue and know the workaround, please advise.
问题:
回答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:
- Run app on your device. It would be better if you set Release build in Edit scheme menu.
- Go to the Debug navigator section on your Navigator (left menu in Xcode).
- Click on CPU.
- Click on Profile in Instruments and choose Transfer.
- Instruments will run Time Profiler. Then in top panel click on Library button (looks like "+").
- Library menu will open. You need to select your instrument.