On Sat, 29 Jan 2011 16:29:53 +0100, Travis Kirton <tkir...@gmail.com> said: >Hi, > >I am creating an aggregate object, for a project, with an initialization >method: > >-(id)initWithString:(id)aString { > if(![super init]) { > return nil; > } > if([aString isKindOfClass:[NSString class]]) { > self.string = (NSString *)aString; > self.attributes = nil; > } > else if ([aString isKindOfClass:[CFAString class]]) { > self.string = ((CFAString *)aString).string; > self.attributes = ((CFAString *)aString).attributes; > } > else { > CFALog(@"Type is not CFAString or NSString"); > return nil; > } > return self; >} > >The function runs fine and executes for passing both an NSString and a >CFAString object... >I can pass any objective-c type without a warning, but when I pass my own >object called CFAString (even though it is an NSObject), the following warning >appears: > >warning: incompatible Objective-C types 'struct CFAString *', expected 'struct >NSString *' when passing argument 1 of 'initWithString:' from distinct >Objective-C type
The problem is that the name "initWithString:" is taken. Pick another name. m. -- matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/> A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com