Error while passing Stringvalue to Textfield

Discussion in 'Mac Programming' started by Stendec, Apr 7, 2008.

  1. macrumors newbie

    Joined:
    Apr 7, 2008
    #1
    Hello,

    I just began programming with Xcode, after I switched from php/javascript. I 'm beginning to understand the basics. But a certain warning keeps showing up, so I think I'm doing somethink very wrong.

    I'm trying to pass a stringValue to a textField. Here's the code below:

    header:
    Code:
    #import <Cocoa/Cocoa.h>
    
    
    @interface Controller : NSObject {
    
    	IBOutlet NSTextField *myField;
    		
    }
    
    - (IBAction)check:(id)sender;
    
    @end
    
    The Class:
    Code:
    #import "Controller.h"
    
    @implementation Controller
    
    - (IBAction)check:(id)sender {
    	
    [myField setStringValue:"GOED"];  // <--- here's the error
    		
    }
    
    @end
    When I compile this, I get this error (twice):

    How do I solve this?

    Thanks in regard,
    Edwin
     
  2. macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #2
    Code:
    [myField setStringValue:"GOED"];
    should be

    Code:
    [myField setStringValue:@"GOED"];
    (Notice the @ character)
     

Share This Page