Setting up relationship via drag and drop

  • I'm cooking up a CD app in which I want to set up 'work order -
    customer' relationship with drag and drop. I've tried and looked over
    and over again but I always end up with an error

    '2007-09-17 08:54:19.853 Verstas[20297] *** -[customerMO
    copyWithZone:]: selector not recognized [self = 0x34cba0]'

    On the actual d&d operation I seem to have everything ok (according
    to the log statements) up to the point where the actual relationship
    is setup with [[selectedObjects objectAtIndex:i] setValue:object
    forKey:@"customer"];. As the error hints to me there's something
    funky in my customerMO class but I really can't figure what to
    exactly look for. Though I have subclassed the customerMO this error
    happened even though the class was instance of NSManagedObject. Below
    is the drag and drop operation which leads to the above error.

    -(BOOL)performDragOperation:(id <NSDraggingInfo>)sender
    NSPasteboard *pb = [sender draggingPasteboard];
    NSString *newURI = [pb stringForType:NSStringPboardType];
    NSLog(@"newURI: %@", newURI);
    NSArray *selectedObjects = [orderArray selectedObjects];
    unsigned int i, count = [selectedObjects count];

    //we need the managed object context and coordinator
    NSManagedObjectContext *context = [orderArray managedObjectContext];
    NSPersistentStoreCoordinator *coordinator = [context

    for (i=0 ; i < count ; i++) {
      NSLog(@"setting new relationship with orderNo %@",
    [[selectedObjects objectAtIndex:i] valueForKey:@"workOrderId"]);
      NSURL *url = [NSURL URLWithString:newURI];
      NSManagedObjectID *objectID = [coordinator
      id object = [context objectWithID:objectID];
      NSLog(@"On the other end of relation is %@", [object
      [[selectedObjects objectAtIndex:i] setValue:object
    return YES;

    -jokke h.
previous month september 2007 next month
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today