On Wed, Sep 30, 2009 at 6:41 PM, David Hirsch <dhir...@mac.com> wrote: > I cannot figure out why this does not work: > > Phase *thisPhase = [phases objectAtIndex:i]; > float testmode = [thisPhase mode]; > float testmode2 = [[phases objectAtIndex:i] mode]; > > Following along with the code execution in the debugger, testmode gets the > correct value, but testmode2 gets an erroneous value. Note that phases is > an NSMutableArray of Phase* and mode is a trivial accessor for a float > stored inside Phase: > > - (float) mode {return mode;}
Something else, probably in Cocoa, is defining a "mode" selector before you do with a different return type. When ObjC can't determine the exact signature of a selector (for example, because the instance type is "id") it uses the first one it finds. Searching through the header files, I see at least two candidates it's probably choosing: ./AppKit.framework/Versions/C/Headers/NSColorPanel.h:- (NSColorPanelMode)mode; ./AppKit.framework/Versions/C/Headers/NSMatrix.h:- (NSMatrixMode)mode; You can make it work with: float testmode2 = [(Phase*)[phases objectAtIndex:i] mode]; _______________________________________________ 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