Re: Distributed Objects and Retain
Re: Distributed Objects and Retain
- Subject: Re: Distributed Objects and Retain
- From: David McGavran <email@hidden>
- Date: Thu, 2 Feb 2006 15:16:03 +0100
For those playing along at home:
I got rid of all my warnings.
I didn't derive my protocols from <NSObject> instead I make sure that
when I receive or pass protocols around I always do that as raw id.
When I want to use the protocol then I cast it to the correct
protocol. If I always operate only on id everything seems to work.
Thanks for the help!
Cheers
Dave
On Feb 2, 2006, at 1:28 PM, David McGavran wrote:
Round and round I go....
I get a different set of warnings now.
I have a protocol:
@protocol MyProtocol <NSObject>
@end
this fixes the does not conform to the NSObject warning and the -
retain warning.
However, when I derive from that protocol:
@interface MyObj : NSObject <MyProtocol>
@end
I then get tons of warnings that my object doesn't have
implementations of all the NSObject methods.
What am I missing?
Thanks!
Dave
On Feb 1, 2006, at 7:30 PM, Clark Cox wrote:
On 2/1/06, David McGavran <email@hidden> wrote:
Hi Ofri,
Thanks for the tip. I can't actually cast it to (MyClass*) as that
is actually private to the server, only the protocol is visible to
the client. When I cast it to NSObject that didn't remove the
warning. Interestingly it only seems to happen for one of my
protocols.
I also get the following warning:
warning: type 'id <MyProtocol>' does not conform to the 'NSObject'
protocol
Any ideas on that?
You could make your protocol conform to the NSObject protocol,
like so:
@protocol MyProtocol <NSObject>
/* methods */
@end
Thanks!
Dave
On Feb 1, 2006, at 6:50 PM, Ofri Wolfus wrote:
You can either cast the proxy of the object to (MyClass *) or to
declare it as id <NSObject>. The first option will save some other
potential warnings for you at the same time.
I hope this helps,
- Ofri
On 01/02/2006, at 19:01, David McGavran wrote:
I have a server app that vends a single object. From that object
you can iterate over several objects. Each time I return a new
object as an ID I want to stor e it on the client side as a member
variable of a client object. If I don't retain it I get crashes
as the object goes away. If I retain it, I watch the ref count go
up and everything works. However I am worried in that xcode tells
me this:
warning: '-retain' not found in protocol(s)
That makes me nervous. What is the correct way to store a local
copy of an object on the client side?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40adobe.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
Clark S. Cox III
email@hidden
My CV/Resume:
http://homepage.mac.com/clarkcox3/files/Resume.pdf
http://homepage.mac.com/clarkcox3/files/Resume.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden