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

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -