On Fri, Nov 12, 2010 at 9:09 AM, Paul Johnson <p...@askerko.net> wrote:

> I'm getting a compiler warning message at the following line of code:
>
>    NSArray *selectedObjects = [[secondTableView dataSource]
> selectedObjects];
>
> The warning message is <'selectedObjects' not found in protocol>.
>

Note that NSTableView's -dataSource returns an object of type
id<NSTableViewDataSource>. So, the compiler knows nothing about the object
other than its protocol conformance. Since -selectedObjects isn't part of
the protocol, it gives this warning.


> Can someone suggest what I need to do to remove the warning?
>

Use a type cast to tell the compiler what class the data source really is:

  NSArray *selectedObjects = [(MyDataSourceClass*)[secondTableView
dataSource] selectedObjects];

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to