I have 2 NSArrays of 2 different types of custom objects. 

Object A properties: 
ID:
Name:
Author:

Object B Properties:
bookID:
value:
terminator:

I need to filter an array of objects of type "A" that has the ID value equal to the bookID value of any of the objects of the second array that contains objects of type "B". 

I tried to use the intersectSet: method by converting the arrays to sets, but since both the objects are of different type, nothing happened. 

What will be the most efficient way to do the filtering? Can I specify the properties to look when I am doing an intersect?
['https://Stackoverflow.com/questions/25891060', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1200174/']
I m hopping your 2 NSArrays are like 

arrayA = 
(
ObjectA1,
ObjectA2,
.
.
ObjectAn
)

and 

arrayB = 
(
ObjectB1,
ObjectB2,
.
.
ObjectBn
)

In this case you have to first extract the values into separate arrays using predicate like this for both arrayA and arrayB

```
NSPredicate *predicateA = [NSPredicate predicateWithFormat:@"id"];
NSArray *arrayAWithonlyIds = [arrayA filteredArrayUsingPredicate:predicateA];

NSPredicate *predicateB = [NSPredicate predicateWithFormat:@"bookId"];
NSArray *arrayBWithonlyBookIds = [arrayA filteredArrayUsingPredicate:predicateB];

```

Now you have to convert these result array containing only ids to NSSet inorder to perform set operation like intersection like this

```
NSMutableset *setResult = [NSMutableSet setWithArray: arrayAWithonlyIds];
[setResult intersectSet:[NSSet setWithArray: arrayBWithonlyBookIds]];

```

I hope this gives you an Idea.
I used NSPredicate for filtering array;
here is the code:

```
+(void)findIntersectionOfAuthors:(NSArray *)authors withBooks:(NSArray *)books
{

    NSLog(@"CLASS A");
    for (Author * aut in authors)
        [aut print];
    NSLog(@"CLASS B");
    for (Book * b in books)
        [b print];

    NSMutableArray * resultOfpredicates = [NSMutableArray new];

    for (Author * a in authors)
    {
        NSPredicate * predicate = [NSPredicate predicateWithFormat:@"SELF.bookID == %d", a.authId];//this predicate search field of bookID equality in books array
        NSArray * bks = [books copy];
        bks = [bks filteredArrayUsingPredicate:predicate];//filters here

        if ([bks count])
        [resultOfpredicates addObject:a];
    }

    NSLog(@"RESULT");
    for (Author * a in resultOfpredicates)
        [a print];
}

```

i created Author (class A) and Book (class B) classes. here is the result of my code

```
2014-09-17 18:10:27.803 Predicate[10725:60b] CLASS A
2014-09-17 18:10:27.803 Predicate[10725:60b] id:100 name:1 author:23
2014-09-17 18:10:27.803 Predicate[10725:60b] id:100 name:2 author:24
2014-09-17 18:10:27.804 Predicate[10725:60b] id:102 name:1 author:25
2014-09-17 18:10:27.804 Predicate[10725:60b] id:109 name:1 author:26
2014-09-17 18:10:27.804 Predicate[10725:60b] id:101 name:1 author:27
2014-09-17 18:10:27.805 Predicate[10725:60b] CLASS B
2014-09-17 18:10:27.805 Predicate[10725:60b] bookId:100 value:12 term:12
2014-09-17 18:10:27.805 Predicate[10725:60b] bookId:101 value:13 term:13
2014-09-17 18:10:27.805 Predicate[10725:60b] bookId:102 value:13 term:13
2014-09-17 18:10:27.806 Predicate[10725:60b] bookId:103 value:13 term:13
2014-09-17 18:10:27.806 Predicate[10725:60b] bookId:104 value:13 term:13
2014-09-17 18:10:27.808 Predicate[10725:60b] RESULT
2014-09-17 18:10:27.809 Predicate[10725:60b] id:100 name:1 author:23
2014-09-17 18:10:27.809 Predicate[10725:60b] id:100 name:2 author:24
2014-09-17 18:10:27.809 Predicate[10725:60b] id:102 name:1 author:25
2014-09-17 18:10:27.809 Predicate[10725:60b] id:101 name:1 author:27

```

hope it helps.