I need help with this error in cocoa

Discussion in 'Mac Programming' started by italiano40, Jul 23, 2008.

  1. italiano40 macrumors 65816

    italiano40

    Joined:
    Oct 7, 2007
    Location:
    NY
    #1
    error: void value not ignored as it ought to be

    what should i do here is the code
    Code:
    NSString *ip=[ipaddresstextbox selectText:self];
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    You're assigning the result of a void function to an NSString *. The error means "that thing returns nothing, so you can't assign it to something". From:
    http://developer.apple.com/document...//apple_ref/occ/instm/NSTextField/selectText:

    "selectText:
    Ends editing and selects the entire contents of the receiver if it’s selectable.

    Code:
    - (void)selectText:(id)sender
    "

    selectText returns void. I think you want stringValue.

    -Lee
     
  3. cMacSW macrumors regular

    Joined:
    Mar 20, 2006
    #3
    You need to use:

    Code:
    - (NSString *)stringValue
     

Share This Page