1,首先要想到这应该是循环导致的问题,现在用Time Profiler查找问题

由上图可以看到是控制器NormalVC 的setBatCheck 方法导致的CPU 100%的问题。


2,解决办法,代码改成
while(self)
{
if(self.centerBle.connect)
{
[_centerBle curBatCheckCmd];
}
[NSThread sleepForTimeInterval:2];
}
1,首先要想到这应该是循环导致的问题,现在用Time Profiler查找问题
由上图可以看到是控制器NormalVC 的setBatCheck 方法导致的CPU 100%的问题。
2,解决办法,代码改成
while(self)
{
if(self.centerBle.connect)
{
[_centerBle curBatCheckCmd];
}
[NSThread sleepForTimeInterval:2];
}
本文标题:iOS CPU占有率高达100%甚至更多,然后导致app耗电严重
本文链接:https://www.haomeiwen.com/subject/ktmfnctx.html
网友评论