我将一个值存储在NSMutableArray
...但是当我尝试检索它时,它找不到它。
我的目标是寻找信标主要 id。如果找到新的信标主要 id,我将其保存在数组中。所以下次当我读取信标主要 id 时,如果它已经存在于数组中,我不会使用它。
for (int i=0; i<numberOfBeacondsInRange; i++)
{
NSLog(@"Processing current beacon: %d of %d", i, numberOfBeacondsInRange-1);
ESTBeacon *currentBeacon = [self.beaconsArray objectAtIndex:i];
// not able to retrive values from the array to compare
BOOL isPresent=NO;
for (int j=0; j<100; j++)
{
if ([visitedBeaconsArrayMajor objectAtIndex:j] == currentBeacon.major)
{
NSLog(@"Already seen");
isPresent=YES;
}
}
if (isPresent==NO)
{
[visitedBeaconsArrayMajor addObject:currentBeacon.major];
NSLog(@"Add major:%@",currentBeacon.major);
}
}