Integrated debuggers are wonderful. However, sometimes they get in the way. Old school “print outs” are a simple tool for figuring out what the code is really doing.
Here are examples for displaying the current function and an object.
- print (“DEBUG ” + myObject.myAttribute)
- Note: to get all the attributes from myObject, will need to loop them
- NSLog(@”%s”, __FUNCTION__);
- NSLog(@”%@”, myObject);
- Log.i(“dev”, new Exception().getStackTrace().toString());
- Log.i(“dev”, myObject.toString());
- Note: In Java, your object (or its parent) may need a toString() method.
- echo __FUNCTION__;
- echo “<pre>” . print_r($myObject, true) . “</pre>”;