iPhone Application: Best Practices for Minimizing Battery Usage?
What are the major factors that might cause an appli开发者_C百科cation to consume more battery power?
As an iPhone app developer, what best practices can I apply to minimize battery use?
- Minimise CPU usage.
- Use a profiler to find hot-spots in your code. Unlike desktop apps, where the goal is "fast enough," here, the goal is, "as little CPU as is humanly possible."
- Read up on background operation, because the way your app behaves in the background can have a significant effect on battery life.
- Avoid telling the app not to sleep via UIApplication.idleTimerDisable. If you need to use it, turn it on an off as a appropriate, rather than disabling it once at application startup time.
- Try to only keep OpenGL render loops running if the scene is changing.
精彩评论