1
-(FileGame *)objectAtXandY:(int) posX secondPos:(int)posY
{

    if (posX < 0 || posX >= kBoxWidth || posY < 0 || posY >= kBoxHeight)
    return OutBorderStart;

    return (FileGame*)[[content objectAtIndex:posY]objectAtIndex:posX];
}

-(void) checkWith:(BOOL)orien
{
int iMax = (orien == isLandscape) ? size1.width : size1.height;
int jMax = (orien == isPortrait) ? size1.height : size1.width;
for (int i=0; i<iMax; i++) 
{
    int count = 0;
    int balValue = -1;
    for (int j=0; j<jMax; j++)
    {
      FileGame* tile =[self objectAtXandY:(orien == isLandscape) ?i :j secondPos:(orien == isPortrait) ?j :i];

      [readyToRemove addObject:tile];   
 }
}
FileGame* square = [readyToRemove objectAtIndex:2];
    square.value1 = 0;
  if(square.value1==balVal)
  {
    //some thing to do  
  }
else{
//some thing to do
}
}

Here readyToRemove is NSMutableArray,balVal is int,FileGame is CCNode.While i run this i'm getting -[__NSCFNumber value1]: unrecognized selector sent to instance error help me.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Prabakaran
  • 258
  • 2
  • 14

2 Answers2

1

The object at index 2 of that array is not a FileGame object. It's a NSNumber. Either you've populated the array in a way you didn't intend or, more likely, the object you expected to find there has been released and the address re-used for a different object.

Turn on zombies in your scheme and you will probably get a better error message.

Also, try logging the value of square when you assign it and verify the data type.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
0

Becareful objective-c isn't really type safe until runtime. I would check your code to make sure you're not putting NSNumber's into that array. Put a break point after you pull it out of the array you'll see.

rfrittelli
  • 1,211
  • 13
  • 15