Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Stendec

macrumors newbie
Original poster
Apr 7, 2008
1
0
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):

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

How do I solve this?

Thanks in regard,
Edwin
 
Code:
[myField setStringValue:"GOED"];

should be

Code:
[myField setStringValue:@"GOED"];

(Notice the @ character)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.