I have created an NSInvocationOpertion object as follows
NSString *myString = @"Jai Hanuman";
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(taskMethod) object:myString];
NSOperationQueue *operatioQueue = [[NSOperationQueue alloc] init];
[operatioQueue addOperation:operation];
and can anybody tell me how can I access the myString object in taskMethod? Is it possible?
- (void)taskMethod{
NSLog(@"Oh! Invocation's working buck");
}
You can try this:
Change your method to:
- (void)taskMethod:(NSString *) message{
NSLog(@"Oh! Invocation's working buck");
message=//your string object;
}
and
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(taskMethod:) object:myString];