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

Heisler98

macrumors member
Original poster
Oct 30, 2010
73
0
I'm a newbie to developing and could someone help me with warnings that keep popping up on a project? I'm using Lynda.com's iPhone SDK development tutorials and I built a small project and it executes fine, but it has warnings and I want to know exactly what they mean. Could someone help?

It has 4 warnings with something about incomplete implementation in this class i made: Dog. :)

Link here to the project folder: http://www.huntereisler.com/xcodeproj/CustomClass

Much appreciated,
Hunt
 
Sorry:

1st: 'Dog' may not respond to '-howl'
(Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)

2nd: 'Dog' may not respond to '-howl'. (Don't understand why this was listed twice, maybe cuz I had it in both the .h and the .m files?)

3rd: Incomplete implementation of class 'Dog'
4th: Method definition for '-Howl' not found


I did the exact thing to recreate the object from what the Lynda.com guy said, and yet, I get warnings. Huh.

Would I be rejected by Apple's App Store (if (1) this was an iPhone app and (2) it was much more sophisticated) if it had warnings?

Thx.
 
Code from the posted url:
Code:
@interface Dog : NSObject {
	//ivars
	int age;
	NSString *name;
}
//public methods 
- (void) bark;
- (void) setName: (NSString *) n;
- (void) Howl;
Objective-C is case-sensitive. -Howl is not the same as -howl.

Code:
@implementation Dog
- (void) bark {
	NSLog(@"Woof, says %@", name);
}

- (void) setName: (NSString *) n {
	name = n;
}

- (void) howl {
	NSLog(@"HOWL, says %@", name);
}
You've implemented -howl, but haven't implemented -Howl.
 
Would I be rejected by Apple's App Store (if (1) this was an iPhone app and (2) it was much more sophisticated) if it had warnings?

Thx.

it looks like the "why" was answered. It wouldn't be rejected, but your code is not going to work as you intend. In this case, you would get an error if you tried to call the howl method.
 
In this case, you would get an error if you tried to call the howl method.

No, -howl works, because there is an actual implementation for -howl.

A runtime error will occur if you tried to call -Howl, which is declared in Dog's @interface, but which has no implementation.

Try it.
Code:
[B]gcc -framework Foundation Dog.m dogmain.m[/B]
Dog.m:24: warning: incomplete implementation of class 'Dog'
Dog.m:24: warning: method definition for '-Howl' not found
dogmain.m: In function 'main':
dogmain.m:19: warning: 'Dog' may not respond to '-howl'
dogmain.m:19: warning: (Messages without a matching method signature
dogmain.m:19: warning: will be assumed to return 'id' and accept
dogmain.m:19: warning: '...' as arguments.)
dogmain.m:20: warning: 'Dog' may not respond to '-howl'

[B]./a.out[/B]
2011-03-06 15:53:45.492 a.out[23665] Woof, says Fido
2011-03-06 15:53:45.492 a.out[23665] Woof, says Lucky
2011-03-06 15:53:45.492 a.out[23665] HOWL, says Lola
2011-03-06 15:53:45.492 a.out[23665] HOWL, says Hank

dogmain.m (from CustomClass.m of linked original)
Code:
#import <Foundation/Foundation.h>
#import "Dog.h"
int main (int argc, const char * argv[]) {
    
	Dog *a = [Dog new];
	[a setName:@"Fido"]; 
	
	Dog *b = [Dog new];
	[b setName:@"Lucky"];
	
	Dog *c = [Dog new];
	[c setName:@"Lola"];
	
	Dog *d = [Dog new];
	[d setName:@"Hank"];
	
	[a bark];
	[b bark];
	[c howl];
	[d howl];
	
	
    return 0;
}
Leaky, but it howls.
 
Thanks you guys. Forgot that the guy said Objective-C was case sensitive. Just wish the gcc compiler was smart enough to figure out the actual problem rather than just tell you jargon that I have yet to figure out. :)

But hey, it's NeXTStep, Darwin, and whatever other hell that's incorporated in there.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.