title: Cannot create BOOL from object
body: <p>I am following the guide cocoa programming for mac os x, 4th edition.In the 32th chapter I messed up the code, and I didn't backup it, so I had to download the solutions from big nerd ranch.<br>
  The project is about core data relashionships, there is a class Employee and a class Department.  </p>
  
  <p>Employee.h :  </p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;CoreData/CoreData.h&gt;
  
  @class Department;
  
  @interface Employee : NSManagedObject
  
  @property (nonatomic, copy) NSString * firstName;
  @property (nonatomic, copy) NSString * lastName;
  @property (nonatomic, retain) Department *department;
  @property (nonatomic, readonly) NSString *fullName;
  
  @end
  </code></pre>
  
  <p>Employee.m :  </p>
  
  <pre><code>#import "Employee.h"
  #import "Department.h"
  
  
  @implementation Employee
  
  @dynamic firstName;
  @dynamic lastName;
  @dynamic department;
  
  + (NSSet *)keyPathsForValuesAffectingFullName
  {
      return [NSSet setWithObjects:@"firstName", @"lastName", nil];
  }
  
  - (NSString *)fullName
  {
      NSString *first = [self firstName];
      NSString *last = [self lastName];
      if (!first)
          return last;
      if (!last)
          return first;
      return [NSString stringWithFormat:@"%@ %@", first, last];
  }
  
  @end
  </code></pre>
  
  <p>Department.h :  </p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;CoreData/CoreData.h&gt;
  
  
  @interface Department : NSManagedObject
  
  @property (nonatomic, retain) NSString * deptName;
  @property (nonatomic, retain) NSSet *employees;
  @property (nonatomic, retain) NSManagedObject *manager;
  @end
  
  @interface Department (CoreDataGeneratedAccessors)
  
  - (void)addEmployeesObject:(NSManagedObject *)value;
  - (void)removeEmployeesObject:(NSManagedObject *)value;
  - (void)addEmployees:(NSSet *)values;
  - (void)removeEmployees:(NSSet *)values;
  
  @end
  </code></pre>
  
  <p>Department.m : </p>
  
  <pre><code>#import "Department.h"
  #import "Employee.h"
  
  @implementation Department
  
  @dynamic deptName;
  @dynamic employees;
  @dynamic manager;
  
  - (void)addEmployeesObject:(Employee *)value
  {
      NSLog(@"Dept %@ adding employee %@",
            [self deptName], [value fullName]);
      NSSet *s = [NSSet setWithObject:value];
      [self willChangeValueForKey:@"employees"
                  withSetMutation:NSKeyValueUnionSetMutation
                     usingObjects:s];
      [[self primitiveValueForKey:@"employees"] addObject:value];
      [self didChangeValueForKey:@"employees"
                 withSetMutation:NSKeyValueUnionSetMutation
                    usingObjects:s];
  }
  
  - (void)removeEmployeesObject:(Employee *)value
  {
      NSLog(@"Dept %@ removing employee %@",
            [self deptName], [value fullName]);
      Employee *manager = (Employee *)[self manager];
      if (manager == value) {
          [self setManager:nil];
      }
      NSSet *s = [NSSet setWithObject:value];
      [self willChangeValueForKey:@"employees"
                  withSetMutation:NSKeyValueMinusSetMutation
                     usingObjects:s];
      [[self primitiveValueForKey:@"employees"] removeObject:value];
      [self didChangeValueForKey:@"employees"
                 withSetMutation:NSKeyValueMinusSetMutation
                    usingObjects:s];
  }
  
  
  @end
  </code></pre>
  
  <p>I have those core data relashionships and entities:  </p>
  
  <p><img src="https://i.stack.imgur.com/7clvM.png" alt="Department"></p>
  
  <p><img src="https://i.stack.imgur.com/iOWwd.png" alt="Employee"></p>
  
  <p>I also use some array controllers to bind the core data values to some outlets.<br>
  The full project can be found <a href="http://www.bignerdranch.com/book/cocoa_programming_for_mac_os_x_th_edition_" rel="nofollow noreferrer">here</a>., 32th chapter (it's identical to mine) in "download solutions".
  Tell me if you need more code to understand this error:  </p>
  
  <pre><code>2012-10-31 15:27:43.977 Departments[1229:303] Cannot create BOOL from object (
  ) of class _NSControllerArrayProxy
  2012-10-31 15:27:43.989 Departments[1229:303] Cannot create BOOL from object (
  ) of class _NSControllerArrayProxy
  </code></pre>
  
  <p>Seems like posting a whole project is not recommended, but I could do so if you say it's ok.  </p>
  
  <p>PS: I' using the code downloaded from solutions, it's the same but it doesn't work, maybe because I have a higher version of xcode.</p>