I can't figure out why variable number is not being assigned to array self.items.
In the debugger it is showing value of NULL.
-(void)pushItem:(double)number{
[self.items addObject:[[NSNumber alloc]initWithDouble:number]];
if (self.items.lastObject == 0)
{
// ** need to add variable number to self.items array**
}
}
itemsproperty. Also, yourifcheck isn't doing what you probably think it is trying to do. The only way that will ever be true is ifself.itemsis nil or if there are no objects in the array.[self.items addObject:@(number)];.self.itemsnil?self.items.lastObject == 0doesn't seems to be the correct way too. Did you meantif ([self.items.lastObject equalsTo:@(0.0)])orif (self.items.lastObject == nil)? ... ?