【发布时间】:2013-05-30 07:19:08
【问题描述】:
我有 3 个NSMutableArray。我想比较三个中的两个 NSMutableArray 并找到不同的索引并存储在 anotherNSMutableArray 中。我想在第三个NSmutableArray不保存时打印这句话。
这是我的代码,但它不起作用:
NSMutableArray *jsonArray = [[NSMutableArray alloc]init];
jsonArray = [dic objectForKey:@"Modified"];
NSMutableArray *sqliteArray = [[NSMutableArray alloc]init];
[sqliteArray addObjectsFromArray:ModiArray];
differentValue = [[NSMutableArray alloc]init];
//guys jsonArray and SqliteArray not different index
if ([jsonArray count] == [sqliteArray count])
{
for (int i = 0; i < [sqliteArray count]; i++)
{
if (![jsonArray[i] isEqual:sqliteArray[i]])
{
[differentValue addObject:[NSNumber numberWithInt:i+1]];
}
}
//My problem here!!! when I NSLog differentValue show me empty but when I write this code dont work
if (differentValue == NULL)
{
NSLog(@"this array is null");
}
}
【问题讨论】:
标签: ios objective-c null nsmutablearray