Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Protocols
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Protocols



How about declaring the protocol to conform to NSObject

@protocol MyProto <NSObject>


Does that fix it?      -DT

On Mar 27, 2005, at 8:24 PM, Valia Vaneeva wrote:

On Mar 28, 2005, at 03:54, Dan Treiman wrote:

Did you mean:

id < MyProto> anObject;
anObject
A= [[MyProtoConformingClass alloc] init];
[anObject release]; // release is not defined in MyProto

Sorry, it was a typo :( In the second and third lines of my snippet "id" must be replaced with "anObject".


id is a shorthand for the variable type (void *); anObject is the name of the object declared.
However, it looks to me like thats just a typo.


Also, make sure that MyProtoConformingClass inherits from NSObject (or a subclass of NSObject), because thats where release, autorelease, retain are implemented.

Yes, it does inherit from NSObject. But the warning remains.

--
A
„r„p„|„‘

How about declaring
Athe protocol conform to NSObject

@protocol MyProto <NSObject>


ADoes that fix it?


A A A -DT

On Mar 27, 2005, at 8:24 PM, Valia Vaneeva wrote:

On Mar 28, 2005, at 03:54, Dan Treiman wrote:

Did you mean:

id < MyProto> anObject;
anObject
A= [[MyProtoConformingClass alloc] init];
[anObject release]; // release is not defined in MyProto

Sorry, it was a typo :( In the second and third lines of my snippet "id" must be replaced with "anObject".

id is a shorthand for the variable type (void *); anObject is the name of the object declared.
However, it looks to me like thats just a typo.


Also, make sure that MyProtoConformingClass inherits from NSObject (or a subclass of NSObject), because thats where release, autorelease, retain are implemented.

Yes, it does inherit from NSObject. But the warning remains.

--
A
„r„p„|„‘



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Student-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Protocols (From: Valia Vaneeva <email@hidden>)
 >Re: Protocols (From: Dan Treiman <email@hidden>)
 >Re: Protocols (From: Valia Vaneeva <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.