objective c - performSelector in NSOperation subclass -


I could not find an answer anywhere on the net, so any help would be appreciated.

I am trying to create a system from which I can get the results of an NSOperation task, which I think can not be done by solid sub-classes such as NSNWonction.

I have an NSOperation subclass ( TheEngine ) that is abstract according to the conference and should be expanded to implement -man , to execute the code To include the code for

TheEngine contains the following initial functions, whose work only is to note the the selector and theObject . It also registers a KV supervisor for the property isFinished :

  - (id) initWithCallbackSelector: (SEL) Thelector inObject: (id) theObject   

See my in ValatForKeyPath: ofObject: change: context: function I would like to call the callback function like this:

  NSLog (@ " To ensure some debug text, this function is being called ", zero); [Object executor: object with selector: after some data: 1];   

The entire process happens in this way:

Enhances the expansion of aViewController TheEngine - Says < The Task and adding it to the Operation Queue. Task = TT = [[Task Alloc] initWithCallbackSelector: @selector (resultHandler :) inObject: theObject];

Everything starts running as expected without any errors or exceptions. But when the execution sees ValleForKeyPath: ofObject: change: context: Callback is not actually said I am new to Obj-C, so I'm not completely sure that this kind of threading My understanding is correct.

Here's the full code:

  - (id) initWithCallbackSelector: Object in the selector (s): theObject {if ([self init]) {self selector} OBject = theObject; Self.selectorToCallFhenished = theSelector; [Self add-onserver: Self PayPal for: @ "Failed" option: NSKeyValueObservingOptionNew Reference: NULL]; Self return; } Return zero; } - (zero) observeValueForKeyPath: (NSString *) mainpath ofObject: (id) theObject change: (NSDictionary *) theChange reference: (zero *) theContext {if ([main path isEqualToString: @ "isFinished"]) {NSLog (@ " Activity has ended with:% @ ", change); NSLog (@ "Target Object:% @", Self Selection Parent Object); NSLog (@ "Target Selector:% @", NSStringFromSelector (self.selectorToCallWhenFinished)); // [Self Performance Selector: Mainstream: Self. When finished with the selector, object: self. Rated Data Waiting Time: No]; [Self. Picture Object Exporter Selector: @SelectorTokel (Object) with the object: Self. Later data data: 0]; }}   

Any help appreciated!

After the

Your nooparation is likely to run on the background background. That thread goes away, or if the thread fails to pump your race loop, then your call to performSelector: withObject: afterDelay: will not be active. You commented on the call at CosactorOnMineThread: ... . It worked

You should probably run this on the main thread or with performSelector running this: withObject: ( without afterDelay: ). performSelector: withObject :. does not require a run loop

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -