Re: WARNINGS from Compiler on "length" how to rid myself of them!
Re: WARNINGS from Compiler on "length" how to rid myself of them!
- Subject: Re: WARNINGS from Compiler on "length" how to rid myself of them!
- From: Chris Roberts <email@hidden>
- Date: Tue, 11 Jun 2002 23:29:40 -0600
I typed the call and it worked
if([(NSString *)anObject length] >6){
.....
}
this fixed it thanks for the help!! all of You!!!
On Tuesday, June 11, 2002, at 01:03 PM, Kevin C. wrote:
On Tuesday, June 11, 2002, at 11:06 AM, Chris Roberts wrote:
I get warnings using the following code:
if ([anObject length] >6){
.....
}
hey Chris, how's it going?
hmmm
what does the log say the length is ?
i just dropped this into a project and this works with no compiler
warnings:
- (IBAction)go:(id)sender
{
NSString *theText = [textField stringValue];
if ([theText length] > 6)
[resultMessageField setStringValue: @"Yes"];
else
[resultMessageField setStringValue: @"No"];
NSLog(@"The string length is: %d ", [theText length]);
}
as well as this:
- (IBAction)go:(id)sender
{
if ([[textField stringValue] length] > 6)
[resultMessageField setStringValue: @"Yes"];
else
[resultMessageField setStringValue: @"No"];
NSLog(@"The string length is: %d ", [[textField stringValue]
length]);
}
and then i tried defining my string in the .h file , and this worked as
well:
- (void)awakeFromNib
{
[textField setStringValue:MYSTRING];
}
- (IBAction)go:(id)sender
{
if ([[textField stringValue] length] > 6)
[resultMessageField setStringValue: @"Yes"];
else
[resultMessageField setStringValue: @"No"];
NSLog(@"The string length is: %d ", [[textField stringValue]
length]);
}
how are you prototyping your string ?
Kevin
anObject is a NSString prototyped in the .h file.
The compiler still tells me that there is :
myController.m:561: warning: multiple declarations for method `length'
/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:53:
warning: using `-(int unsigned)length'
/System/Library/Frameworks/AppKit.framework/Headers/NSStatusItem.h:42:
warning: also found `-(float)length'
How do I fix this ???
Chris Roberts
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.