Is it possible to use "Forwarding" (http://en.wikipedia.org/wiki/Objective-C#Forwarding) in iOS?
I tried the following code I found here:
- (retval_t) forward: (SEL) sel : (arglist_t) args
But I get an error message:
error: expected ')' before 'retval_t'
So I read here and try:
- (retval_t)forward:(SEL)sel args:(arglist_t) args
But I got the same error message...
What am I doing wrong? Do I need to import something?
@bbum: I try to create a thread safe NSMutableArray and want to use the code I found here: NSMutableDictionary thread safety
Yes. What you're seeing there is the GNU variant of Objective-C, which is slightly different from the Apple variant.
You want to use -forwardInvocation:
rather than -forward::
or -forward:args:
. See http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtForwarding.html for more info on how to do it with iOS.