PDA

View Full Version : Error while passing Stringvalue to Textfield




Stendec
Apr 7, 2008, 02:02 PM
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:

#import <Cocoa/Cocoa.h>


@interface Controller : NSObject {

IBOutlet NSTextField *myField;

}

- (IBAction)check:(id)sender;

@end


The Class:

#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):

warning: passing argument 1 of 'setStringValue:' from incompatible pointer type

How do I solve this?

Thanks in regard,
Edwin



Sbrocket
Apr 7, 2008, 02:08 PM
[myField setStringValue:"GOED"];

should be

[myField setStringValue:@"GOED"];

(Notice the @ character)