Check whether an object is an NSArray or NSDictionary

前端 未结 4 618
慢半拍i
慢半拍i 2021-02-01 13:28

As per subject, how can I check whether an object is an NSArray or NSDictionary?

4条回答
  •  一整个雨季
    2021-02-01 13:53

    if([obj isKindOfClass:[NSArray class]]){
        //Is array
    }else if([obj isKindOfClass:[NSDictionary class]]){
        //is dictionary
    }else{
        //is something else
    }
    

提交回复
热议问题