/**
使用for..in..快速枚舉可變數(shù)組,然后再枚舉過程中增刪改可變數(shù)組中的內(nèi)容時(shí)猴仑,
會(huì)報(bào)錯(cuò)“was mutated while being enumerated”
解決辦法就是下面這樣涌庭,復(fù)制一個(gè)同樣的臨時(shí)數(shù)組芥被,快速枚舉臨時(shí)數(shù)組,
然后再枚舉臨時(shí)數(shù)組的時(shí)候坐榆,增刪改原始數(shù)組中的內(nèi)容拴魄,這樣就不會(huì)崩潰報(bào)錯(cuò)了
*/
NSMutableArray *tmpMutableArray = [self.subDeviceArray mutableCopy];
if (tmpMutableArray.count > 0) {
for (GizWifiDevice *device in tmpMutableArray) {
if (device.sharingRole == 1 || device.sharingRole == 2) {
[self.subDeviceArray removeObject:device];
}
}
}