2012-06-05 55 views

回答

3
// Create arrays of the IDs only 
NSArray *notiCloudIDs = [notiCloud valueForKey:@"id"]; 
NSArray *notiLocIDs = [notiLoc valueForKey:@"id"]; 

// Turn the arrays into sets and intersect the two sets 
NSMutableSet *notiCloudIDsSet = [NSMutableSet setWithArray:notiCloudIDs]; 
NSMutableSet *notiLocIDsSet = [NSMutableSet setWithArray:notiLocIDs]; 
[notiCloudIDsSet intersectSet:notiLocIDsSet]; 

// The IDs that are now in notiCloudIDsSet have been present in both arrays 
NSLog(@"Duplicate IDs: %@", notiCloudIDsSet);