Question: I have a method like this:

```
-(void)A:(int)a B:(int)b{    
}

```

and want to put the method into a new thread:

```
NSInvocationOperation *theOp = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:B:) object:nil];

```

but "EXC\_BAD\_ACCESS".

Answer: 
The method you invoke with `NSInvocationOperation` can only take a single parameter, and that parameter must be an Objective-C object (like `NSNumber`) and not a plain C type (like `int`).

Typically, to handle multiple parameters you use an NSDictionary or NSArray to hold the parameters:

```
- (void)myMethod:(NSDictionary*)parameters 
{
    int a = [[parameters objectForKey:@"A"] intValue];
    int b = [[parameters objectForKey:@"B"] intValue];

    // do something with a and b
}

[[NSInvocationOperation alloc] 
    initWithTarget:self
          selector:@selector(myMethod:)
            object:[NSDictionary dictionaryWithObjectsAndKeys:
                     [NSNumber numberWithInt:123], @"A",
                     [NSNumber numberWithInt:456], @"B",
                     nil]];

```

Alternatively, you can use an `NSInvocation` object to invoke your method. This allows any number and any type of parameters, but it's typically much easier to just put your parameters in an NSDictionary than to construct an NSInvocation object.

[Information on how to use NSInvocation.](http://cocoawithlove.com/2008/03/construct-nsinvocation-for-any-message.html)
From Apple's docs: "The selector to invoke when running the operation. The selector may take 0 or 1 parameters;". So if you want to call a method with more parameters, create an extra method with a single parameter and call the method with more parameters from there.