ios - OR statement in the arguments of method -


i have method this:

-(void)examplesend:(nsstring *)gateway byparams:(nsdictionary *)params{     ... } 

now want change params , input argument, support both nsdictionary , nsarray. how can in objective-c ?

change type id instead of nsdictionary , make sure should check inside method if nsdictionary or nsarray before performing class specific actions on it, otherwise cause crash.

-(void)examplesend:(nsstring *)gateway byparams:(id)params{      if([params iskindofclass:[nsdictionary class]]){      }else{      }     ... } 

Comments

Popular posts from this blog

php - Autoloader issue not returning Class -

python - Getting next two indexes regardless of current index -

ruby - Prevent Custom Validation Error on Association -