我有两个要比较的 NSArray — 在 NSLog 输出中它们看起来相同,但不知何故它们并不相等。如果我将 NSArray 转换为 NSString 我会得到相同的结果。将它们与自己进行比较将是平等的。如何确定为什么一和二不相等?谢谢你。
- (void)confused:(NSArray *)two {
NSArray *one = [NSArray arrayWithObjects:@"16777223", @"7", nil];
NSArray *two = [[NSBundle bundleWithPath:@"/path/to/bundle"] executableArchitectures];
// NSArray "two" shows as 16277223, 7 in NSLog
if ([two firstObjectCommonWithArray:(NSArray *)one])
{
NSLog(@"- it's equal %@ %@", one, two);
// if array one matches array two then this will output
}
else {
NSLog(@"- it's NOT equal %@ %@", one, two);
}
return;
}
这是控制台的输出:
myApp (
16777223,
7
)
myApp (
16777223,
7
)
myApp - it's NOT equal (
16777223,
7
)(
16777223,
7
)