When optimizing battery power, when calling hardware devices, such as GPS positioning, it should be processed according to the usage scenario. If it is only positioned once, it should be turned off after use. If positioning is needed all the time, you need to pay attention to the frequency of calls. The same is true for network and Bluetooth. .
I don’t know anything about the code that can directly achieve the effect of saving power. It may be a good way to minimize memory overhead and CPU usage.
1. Try not to leave the sensor on all the time, unless the program requires it, such as GPS; turn it off after use; 2. XCODE also provides an analysis tool for analyzing power consumption, you can use this tool to check.
When optimizing battery power, when calling hardware devices, such as GPS positioning, it should be processed according to the usage scenario. If it is only positioned once, it should be turned off after use. If positioning is needed all the time, you need to pay attention to the frequency of calls. The same is true for network and Bluetooth. .
I don’t know anything about the code that can directly achieve the effect of saving power. It may be a good way to minimize memory overhead and CPU usage.
1. Try not to leave the sensor on all the time, unless the program requires it, such as GPS; turn it off after use;
2. XCODE also provides an analysis tool for analyzing power consumption, you can use this tool to check.