An NSInvocation object contains all the elements of an Objective-C message: a target, a selector, arguments, and the return value. Each of these elements can be set directly, and the return value is set automatically when the NSInvocation object is dispatched.
Questions tagged [nsinvocation]
154 questions
2
votes
0 answers
Monotouch PerformSelector on specific thread with multiple arguments and callbacks
I've been having some issues with threading in monotouch. My app makes use of an external library which I've linked with and it works fine. Because of the nature of the app and the library I have to make all the calls to it on a single separate…

Doc
- 53
- 7
2
votes
3 answers
Performing selectors on main thread with NSInvocation
I want to perform animation on main thread (cause UIKit objects are not thread-safe), but prepare it in some separate thread. I have (baAnimation - is CABasicAnimation allocated & inited before):
SEL animationSelector =…

kpower
- 3,871
- 4
- 42
- 62
2
votes
1 answer
NSInvocation with primitive using getReturnValue
We have the following method, which works for objects. It takes a method on an object and places the result in returnValueContainer:
+ (void)invokePrivateMethod:(SEL)selector returnValueContainer:(NSObject **)returnValueContainer onObject:(NSObject…

Gaurav Sharma
- 2,680
- 3
- 26
- 36
2
votes
0 answers
Retry an NSURLSessionDataTask request after re-authorizing (AKA NSInvocation equivalent in Swift)
TL;DR version: What is the nearest equivalent to NSInvocation - or similar way to package up a method call, including arguments - in Swift?
Background: I have a ServerController object which is used across my app to make requests to an API. The…

Andrew Ebling
- 10,175
- 10
- 58
- 75
2
votes
2 answers
How to force NSUndoManager prepareWithInvocationTarget to retain it's arguments?
NSUndoManager method prepareWithInvocationTarget does not retain arguments. There is no links to this in Apple docs, but I've checked with profiler, and I'm pretty sure - it does not. This means if you are going to delete an object and be prepared…

Alexander Vasenin
- 11,437
- 4
- 42
- 70
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…

user26691
- 77
- 5
2
votes
2 answers
NSInvocation setArgument not working with simple int32_t
I am facing an issue while using NSInvocation with arguments which are not objects.
The simple integer value that I pass gets changed to something different.
Here is the method I am invoking:
+(NSString*) TestMethod2 :(int32_t) number
{
…

Nisha
- 23
- 1
- 3
2
votes
1 answer
Index-based fetching of Objective-C argument values
I want to dynamically create the NSInvocation for the current method with the correct argument values. Typically, one might do this:
- (void)messageWithArg:(NSString *)arg arg2:(NSString *)arg2
{
NSInvocation *invocation = [NSInvocation…

Mike Kwan
- 24,123
- 12
- 63
- 96
2
votes
0 answers
How do you pass a completion block using NSInvocations?
I have an application that makes signed requests to my server. All of the requests require an authentication token. When ever I make a request, if an auth token was not found, I store that request using an NSInvocation, query for the authentication…

Ngoan Nguyen
- 747
- 2
- 9
- 19
2
votes
2 answers
NSInvocation setArgument issue
I need to use NSInvocation to invoke a method dynamically.
Here what I have tried:
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[messageRecord.senderController class]…

SadullahCeran
- 2,425
- 4
- 20
- 34
1
vote
1 answer
iOS NSInvocation setArgument: atIndex: does not work with struct on ARM builds
I have a strange problem with setting the argument of an NSInvocation with a struct that contains a double or any 64 bit type which is not aligned (I offset it with a char at the beginning of the struct). The problem is that some bytes are cleared…

Sam
- 616
- 7
- 19
1
vote
1 answer
Loading images asynchronously into a tableview cells
After searching the internet for weeks & a lot of posts here in stack too, i can't seem to find the way to implement this in my project.
I have a plist in my dropbox account. one of the strings in the plist under one of the dictionaries called…

Maor Zohar
- 592
- 5
- 17
1
vote
2 answers
getArgument of NSInvocation of current method always returns null
I want to get the name of the arguments of the current function I am in so that I can prepare loading that object from the filesystem if it's not present on the current instance. (for instance if [foo dictTest] is not available I want to load it's…

Nonlinearsound
- 928
- 8
- 17
1
vote
0 answers
Send a message to a would-be-generated object
I am in a situation in which I need to send an object and a method name a UIViewController that might or might not be instantiated in the future. To make the matter a bit more interesting, the UIViewController will be pushed to…

Stkim1
- 1,365
- 2
- 9
- 10
1
vote
2 answers
Does nsinvocation invoked?
I'am a newby in objective c and iphone developing. I confused. I trying to create button that are created at the runtime,after clicking another button,and application doesn't know it:
-(void)button4Pushed{
NSLog(@"Button 4 pushed\n");
Class…

Alexander
- 1,228
- 2
- 15
- 29