我用这段代码比较了两个 NSNumber 对象,但它从未通过 if 条件。
listItems = [appDelegate.productStatus componentsSeparatedByString:@","];
for (int i=0;i<[appDelegate.productArray count]; i++)
{
for (int j=0; j<[listItems count]; j++)
{
number=[NSNumber numberWithInt:[[listItems objectAtIndex:j] intValue]];
NSLog(@"number %@",number);
productObject=[appDelegate.productArray objectAtIndex:i];
NSLog(@"%@,%@",productObject.pid,number);
if (productObject.pid == number)
{
NSLog(@"BUY it!!!");
[purchasArray addObject:productObject];
}
}
}
怎么了?