A question about the setLink method

Aug 24, 2010 at 5:10 PM

There is a problem with the method setLink:sourceProperty:targetObject: of the ObjectContext class. According to documentation, its sourceProperty parameter is "The name of the property on the source object that represents the source in the link between the source and the target". I added the following call to my code:

[self.dataSource setLink: parentObject sourceProperty: @"Configuration" targetObject: childObject];

but it throws an "Invalid operation" exception telling that "AddLink and DeleteLink methods only work when the sourceProperty is a collection.". Well, the "Configuration" property is a collection:

@property ( nonatomic , retain , getter=getConfiguration , setter=setConfiguration )NSMutableArray *m_Configuration;

By debugging this call, I found the following "if" statement (ObjectContext.m, line 967):

if([[[array objectAtIndex:j] objectForKey:@"Type"] isEqualToString:sourceProperty])
My question is: why property name is compared with its type?



Aug 25, 2010 at 4:15 AM

Thanks for reporting this issue.

I'm looking into it




Oct 1, 2010 at 1:35 PM

It seems that the problem hasn't been fixed in version 1.1. I updated to this version and I continue receiving the same error. This code:


if([[[array objectAtIndex:j] objectForKey:@"Type"] isEqualToString:sourceProperty])


is not changed.

Oct 13, 2010 at 8:06 PM

I'll check with the dev team. This was supposed to be fixed in the 1.1 release.



Mar 12, 2011 at 12:23 AM

This is fixed in Version 1.2.

Mar 12, 2011 at 12:37 AM

This is fixed in Version 1.2. The fix is detailed here: http://odataobjc.codeplex.com/workitem/10202