2012-01-03 3 views
0

정수 값을 NSMutable 배열로 가져 오는 데 문제가 있습니다. 일치하는 태그 속성 값 (button1의 태그 값이 1 등)이있는 여러 개의 버튼이 화면에 있습니다. 버튼을 누르면 숫자 태그 값이 NSMutable 배열에 추가됩니다. 나중에 개체를 반복하여 쿼리를 작성하기 위해 어떤 값을 누르는 지 확인하려고합니다. 그러나 루프에서 SIGABRT 오류가 발생했습니다.NSMutable 배열에서 정수 데이터 검색

//pairNumber is the 'tag' value from a button 
-(void) numberSearchArray:(NSInteger)pairNumber; 
{ 
    [self.queryPairs addObject:[NSNumber numberWithInt: pairNumber]]; 
} 

//*************************** 

-(void)buildQuery:(BOOL *)function numberToUse:(NSInteger)number 
{ 
    //other code not shown 

    int pair_values [6]; 
    int compare_total = [queryPairs count]; 

    for (int x = 0; x<=compare_total-1; x++){ 
    pair_values[x] = (NSUInteger)[queryPairs objectAtIndex:x]; //SIGABRT error 

    //code continued... 
} 

답변

1

당신은 할 필요가 :

[[queryPairs objectAtIndex:x] intValue]; 
0

pair_values를 확인할 한계가 없는데, queryPairs 배열에 6 개 이상의 항목이 있습니까?

관련 문제