Questions tagged [message-forwarding]

29 questions
15
votes
1 answer

How to forward an HttpRequestMessage to another server

What's the best way to forward an http web api request to another server? Here's what I'm trying: I have a .NET project where when I get certain API requests I want to modify the request, forward it to another server, and return the response sent by…
Zain Rizvi
  • 23,586
  • 22
  • 91
  • 133
13
votes
1 answer

Get block argument from NSInvocation with ARC

I'm trying to get the block argument from the NSInvocation in NSProxy's forwardInvocation: Is this the correct syntax? Would it leak memory? typedef void(^SuccessBlock)(id object); void *successBlockPointer; [invocation…
pshah
  • 2,052
  • 1
  • 21
  • 40
9
votes
2 answers

What does __forwarding__ in the stack trace mean?

(gdb) bt #0 0x302ac924 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ () #1 0x92077e3b in objc_exception_throw () #2 0x302d6ffb in -[NSObject doesNotRecognizeSelector:] () #3 0x3026e056 in ___forwarding___ () #4 0x3024a0a2 in…
Karl
  • 5,613
  • 13
  • 73
  • 107
5
votes
1 answer

How can I just "swallow" the "unrecognized selector error" by message-forwarding?

I'm just studying the "message-forwarding" of Objective-C. I write a test program to verify if I can "swallow" an unrecognized selector at run-time. So I did this: - (void) forwardInvocation: (NSInvocation *) anInvocation { if ([anInvocation…
Jie Wu
  • 51
  • 2
5
votes
1 answer

forwardInvocation: the return value gets lost

I want to use message-forwarding on my SZNUnmanagedReference class. It has this properties: @property (nonatomic, strong) NSSet *authors; @property (nonatomic, strong) SZNReferenceDescriptor *referenceDescriptor; Basically, when an instance of…
4
votes
1 answer

Creating an Objective-C object that wraps another object with the same interface - KVC/KVO issues

I need to create an object in one class hierarchy that wraps an object from a different one. They both have very similar interfaces, and I'd like to automatically have my wrapper forward messages it doesn't recognize to its target in lieu of…
4
votes
2 answers

Message Forwarding in Objective C

Can anyone give a brief explanation of how to use message forwarding? Links Apple documentation: Apple documentation tends to be good as a reference, but lengthy enough to not be the best as an introduction.
Casebash
  • 114,675
  • 90
  • 247
  • 350
4
votes
1 answer

How does forwardingTargetForSelector: work?

I have a UIBarButtonItem. When it receives a message it cannot handle, I want it to forward that message to a particular view controller. I thought I might be able to accomplish this using the bar button item's forwardingTargetForSelector: method,…
mkc842
  • 2,361
  • 2
  • 26
  • 38
3
votes
2 answers

Message forwarding chain

I‘ve read Apple's message forwarding document and other articles, and it seems the ObjC runtime will forward unrecognized messages for an object automatically, and if there isn't a matching selector, it will throw an "unrecognized selector sent to…
johnMa
  • 3,291
  • 24
  • 37
3
votes
1 answer

-forwardInvocation for class methods

I'm struggling to forward a class method through a facade class. To clarify, I'm overriding all the following methods: -(NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector -(void)forwardInvocation:(NSInvocation…
3
votes
2 answers

Is there a way to observe every message calls invoked on an object (iOS)?

I just want to get a selector name, and the arguments, sender, or an NSInvocation instance every time when I send a message to an object. Possible? Something like forwardInvocation:, but in evey case (every method call).
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
2
votes
0 answers

iPad UISplitViewController doesn't forward the -prepareForSegue:sender method

I have a UISplitViewController but my delegate class doesn't ever get the -prepareForSegue:sender message. I've confirmed this is the case because I subclassed UISplitViewController and it's was preparing for every freaking segue it was…
lol
  • 3,910
  • 2
  • 37
  • 40
2
votes
0 answers

iOS message forwarding - negotiate a CLASS method and forward

I'm wondering if it is possible to forward a class method to a different instance. I've had a look at the docs and all the methods shown there are instance level methods. So is there a way I can negotiate and forward a class or static method? Just…
cream-corn
  • 1,820
  • 14
  • 26
2
votes
1 answer

How does Objective-C messaging work? Where is `super`? How to make sure a class has an implementation from its super before method swizzling?

I have some question about Obj-C message. (1) It's my main question: how to make sure a class has an implementation from its superclass before swizzling it or invoking it? If I want to do method swizzling with a method which the target class didn't…
Xaree Lee
  • 3,188
  • 3
  • 34
  • 55
2
votes
1 answer

Swallow doesnotrecognizeselector exception from an NSInvocation forwardInvocation call

I have an object which is forwarding receiving messages. It does not implement forwarding them to other objects using forwardInvocation. However, methodSignatureForSelector will not always return a valid method signature at certain times because of…
1
2