Questions tagged [nsinvocation]

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.

Resource

154 questions
0
votes
3 answers

ASynchronous NSURLConnection inside NSOperation with NSInvocation?

I have to use Asynchrnous NSURLConnection inside NSOPeration in background mode,because its response is having large dataI have to avoid Apple's finite length coding to use in didEnterBackground.instead of it I use following code through…
user141302
0
votes
2 answers

Perform block inside a NSOperation

I have a method in some class which performs some task using a block. When I execute that method using NSInvocationOperation then control never goes to the block. I tried logging inside the block but that is never called actually. But if I simply…
Jitendra Singh
  • 2,103
  • 3
  • 17
  • 26
0
votes
1 answer

NSInvocation getArgument NSString/CFString will lead to bad access

I had a requirement, to use NSInvocation's (void)getArgument:(void *)argumentLocation atIndex:(NSInteger)idx; to get the argument. The argument is primarily NSString, So, in my function: - (void)forwardInvocation:(NSInvocation *)invocation { …
Wingzero
  • 9,644
  • 10
  • 39
  • 80
0
votes
0 answers

Memory Leak NSInvocationOperation

What is possible reason of memory leak in following code snippet? NSInvocationOperation* theOp = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(methodCall:)…
0
votes
1 answer

why the instance method that is "methodSignatureForSelector:" can be invoke by the class object

What make me doubt is that the class object can invoke instance method. The method of "methodSignatureForSelector is instance method but when I invoke it by instance object, it go wrong. NSString *classStr = @"NSInvocationObject"; // 获取class Class…
李晨光
  • 3
  • 1
0
votes
1 answer

NSInvocationOperation with return value (BOOL)

hi i have these invocation operation: NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:ndParser selector:@selector (parseUrl:) object:[NSString stringWithFormat:@"http://URL%@",var]]; my…
Phil
  • 341
  • 6
  • 19
0
votes
0 answers

Can I use NSInvocation to hide or show a subclassed UIView without redrawing it?

I am trying to use invocation to callback a UIView in Objective C and toggle its hidden property. The message must be sent to a custom view in a dedicated class SquareView. For demonstration purposes my invokerMethod will be called from a UIButton.…
Greg
  • 1,750
  • 2
  • 29
  • 56
0
votes
2 answers

How to get performSelector to work with NSInvocation?

I need to pass the touches and event from touchesBegan to my own method called by a performSelector. I am using an NSInvocation to package up the arguments but I'm having problems with the target. The reason that I do it this way is so I can handle…
iphaaw
  • 6,764
  • 11
  • 58
  • 83
0
votes
2 answers

(iphone) nsInvocation leaks .. maybe the passed arguments?

I'm calling a selector on background thread, The selector has NSAutorelasePool around it. I guess the arguments I pass to the selector is causing the problem. How should I deal with it? SEL theSelector; NSMethodSignature *aSignature; …
eugene
  • 39,839
  • 68
  • 255
  • 489
0
votes
1 answer

(iphone) nsInvocation crash question

i'm trying to use NSInvocation for the first time, code below are adopted from other answer codes at stackoverflow. The timer runs fine, but it crashes when it actually expires and executes code at (animationEnd:) UIImageView* animationView…
eugene
  • 39,839
  • 68
  • 255
  • 489
0
votes
2 answers

How to extract an argument of 'function' type from NSInvocation

I am writing a unit test for the function that receives a protocol as input argument. This function that I am testing calls some method of that protocol inside. I want to mock this protocol and that method. To mock the protocol using OCMock I wrote…
Maksym Bondarenko
  • 404
  • 1
  • 5
  • 12
0
votes
1 answer

Why is prepareWithInvocationTarget: specific to NSUndoManager?

Compare... NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[performer methodSignatureForSelector:@selector(playFile:)]]; [invocation setSelector:@selector(playFile:)]; [invocation setTarget:performer]; NSString* string =…
andyvn22
  • 14,696
  • 1
  • 52
  • 74
0
votes
1 answer

How to handle iPhone Simulator NSInvocation issue for iOS4.0+

For iPhone Simulator iOS4.0+, NSInvocation doesn't handle exceptions well. I came across a workaround to use objc_msgSend. When I tried it for the below invocation as objc_msgSend(target_, [invocation selector]) and commenting out [invocation…
user511347
  • 33
  • 3
0
votes
1 answer

NSInvocation with an enum?

------------ EDIT ------------- TL;DR: It seems I used the NSInvocation class incorrectly (lacking pointer knowledge). The way to use those would be like so (Works): NSString *str = @"string"; UIControlState state = UIControlStateNormal; [invocation…
natanavra
  • 2,100
  • 3
  • 18
  • 24
0
votes
3 answers

UIButton with NSInvocation

I am trying to add a button programatically in a way that upon pressing it, a certain object is being passed. I keep on getting "unrecognized selector sent" exception. Can you suggest whats wrong with the code: // allocate the details button's…
Amarsh
  • 11,214
  • 18
  • 53
  • 78