View Full Version : I need help with this error in cocoa
italiano40
Jul 23, 2008, 11:14 PM
error: void value not ignored as it ought to be
what should i do here is the code
NSString *ip=[ipaddresstextbox selectText:self];
lee1210
Jul 24, 2008, 12:14 AM
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/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextField_Class/Reference/Reference.html#//apple_ref/occ/instm/NSTextField/selectText:
"selectText:
Ends editing and selects the entire contents of the receiver if it’s selectable.
- (void)selectText:(id)sender
"
selectText returns void. I think you want stringValue.
-Lee
cMacSW
Jul 24, 2008, 09:05 AM
You need to use:
- (NSString *)stringValue
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.