nsinvocation

Invoking a method on a delegate after delay, from an object at the end of it's lifetime.

I have a modal view controller that creates core data changes in it's own context, and when I click done, it saves the changes (that dispatches the merge changes notification), notifies the delegate and dismisses. My problem is that I need the delegate to receive the message after my main context has merged with the changes of the editi...

Function with argument to a NSInvocation method

Hi, I have a controller view who is using thoses 2 functions: [appDelegate getFichesInfo:[[self.fichesCategory idModuleFiche] intValue] ]; //first function self.fiche = (Fiche *)[appDelegate.fichesInfo objectAtIndex:0]; [appDelegate getFichesVisuels:[[self.fiche idFiche] intValue] ]; //second function not working self.fiche = (Fich...

Over-riding NSObject and adding a class variable

I am using the following code to perform a selector after a delay with multiple passed parameters: http://nifty-box.com/blog/2006/12/nsinvocation-cleans-code.html It works very well, but I need to extend this to support the equivalent of: [NSObject cancelPreviousPerformRequestsWithTarget:self] (target in this case would not be self, ...

NSInvocation argument from UIButton

Hi! I've a small question! I want pass two value from button to a function and i've found the invocation method to make it. But i don't know how to launch the method from button! Example: //INVOCATION SEL mySelector = @selector(playAtTime:setPlay:); NSInvocation *inv = [[NSInvocation alloc] init]; [inv setSelector:mySelector]; //VARS i...

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 = @selector(addAnimation:forKey:); NSString *keyString = @"someViewAnimation"; NSInvocation *inv = [NSInvocation invoca...

NSInvocation object not getting allocated iphone sdk

Hi all, I'm doing NSString *_type_ = @"report"; NSNumber *_id_ = [NSNumber numberWithInt:report.reportId]; NSDictionary *paramObj = [NSDictionary dictionaryWithObjectsAndKeys: _id_, @"bla1", _type_, @"bla2",nil]; _operation = [[NSInvocationOperation alloc] initWithTar...

NSInvocation making app crash

Hi all, I'm using NSInvocation as follows: In my init, I'm writing this in my viewDidLoad: SEL mySelector; mySelector = @selector(initParsersetId:type:); NSMethodSignature * sig = nil; sig = [[self class] instanceMethodSignatureForSelector:mySelector]; myInvocation = nil; myInvocation = [NSInvocation invocationWithMethodSignature:si...

NSInvocation Leaks

I am trying to setup an NSInovcation system to launch selectors into background threads using performSelectorInBackground: - So far everything is successful when running the system on instance methods (-), but I also want to support class methods (+). I have adjusted my code to provide an invokeInBackgroundThread for both types of class ...

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 action SEL selector = @selector(showPropertyDetails:forProperty:); NSMethodSignatu...

NSInvocation not passing pointer to c++ array

Hello, I think I'm making just a fundamental mistake, but I cannot for the life of me see it. I'm calling a method on an Objective-C object from within a C++ class (which is locked). I'm using NSInvocation to prevent me from having to write hundreds methods just to access the data in this other object. These are the steps I'm going t...

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 invoke] under createResponseFromInvocation() hangs. I tried different ways of calling obj_msgSen...

Why is prepareWithInvocationTarget: specific to NSUndoManager?

Compare... NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[performer methodSignatureForSelector:@selector(playFile:)]]; [invocation setSelector:@selector(playFile:)]; [invocation setTarget:performer]; NSString* string = [NSString stringWithString:@"reverse.wav"]; [invocation setArgument:&string atIndex:2]; ...w...