Skip to Content
Objective-C Pocket Reference
book

Objective-C Pocket Reference

by Andrew Duncan
December 2002
Beginner content levelBeginner
128 pages
3h 10m
English
O'Reilly Media, Inc.
Content preview from Objective-C Pocket Reference

Remote Messaging

Objective-C’s method call model lends itself well to distributed systems, where sending messages is the fundamental unit of interaction. The key difference in distributed systems is that objects may exist in different address spaces, and so cannot call each other directly.

Objects that want to receive messages from other processes must specify those messages in a formal protocol. Objective-C provides special keywords to use when writing such a formal protocol that qualify the kind of sharing you will need for that protocol’s message parameters.

You use the keywords to modify (or qualify) the type of a method’s parameter or return value. For example, the keywords out and in modify the parameters in the following declaration:

-(void)getData:(out 
            Data*)data 
            forIndex:(in 
            int)index;

The signature of this method says that index is only passed in and changes to it don’t need to be returned, but the method will modify the value of data.

You can’t use these keywords in class or category declarations. However, if your class or category adopts a protocol that uses a remote messaging keyword, you can repeat the keyword in the method signature of the implementation.

The remote messaging keywords can be grouped into three categories: those for pointer parameters, those for return values, and those for object qualifiers.

Pointer Parameter Qualifiers

This section discusses qualifiers that generally apply to pointer arguments. They tell the compiler how to handle copying values between ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro Objective-C

Pro Objective-C

Keith Lee
Learning Cocoa with Objective-C, 4th Edition

Learning Cocoa with Objective-C, 4th Edition

Paris Buttfield-Addison, Jonathon Manning, Tim Nugent

Publisher Resources

ISBN: 0596004230Errata Page