0

I am having an issue getting integer values form an NSMutable array. I have several buttons on the screen with a matching tag property value (button1 has a tag value of 1, etc.). When a button is pressed, I add the numeric tag value to the NSMutable array. Later, I want to loop through the objects to see what values are pressed to build a query. However, Iget a SIGABRT error in the loop.

//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...
}

2 Answers 2

1

you need to do:

[[queryPairs objectAtIndex:x] intValue];
Sign up to request clarification or add additional context in comments.

Comments

0

You're not bounds checking pair_values, do you have more than 6 items in your queryPairs array?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.