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

I would like to know how to fix my code, or another approach, so that this 
warning doesn't appear...


_______________________________________________

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

Reply via email to