NSRangeException 오류가 발생하며이 매우 기본적인 비트 코드에서 오류를 찾을 수 없습니다. 누군가가 내 맹점을 바로 잡는 데 도움이 될 수 있습니까?NSMutableOrderedSet NSRangeException
uint32_t offsetVal = 0;
int num = 100;
_offsetVals=[[NSMutableOrderedSet alloc]initWithCapacity:num+1];
for (int i=0; i<=num; i++) // note: there is 1 greater offset record than there is glyphs!
{
CFDataGetBytes(tableData, CFRangeMake(offset,4),(UInt8*)&offsetVal);
offsetVal=CFSwapInt32HostToBig(offsetVal);
[_offsetVals insertObject:[NSNumber numberWithInt:offsetVal] atIndex:i];
offset+=4;
}
그러나 응용 프로그램 충돌로 : 'NSRangeException'이유 : '* - [__ NSOrderedSetM의 setObject : atIndex :] : 범위를 넘는 인덱스 3 [0 .. 1]'
앱의 메시지에 i = 3에서 충돌이 발생합니다. 아니, NSMutableOrderedSet의 실제 한계 근처. 하지만 최대 +1 문제를 알아 줘서 고마워! – user216661
내 파일이 손상되었는지 궁금합니다. 파일을 삭제하고 다시 입력하려고합니다. – user216661
거기에 행운이 없습니다. 한숨. – user216661