Search code examples
iphoneobjective-cobjectnslog

How can I see values of Object in NSLog?


Suppose I have an object containing some data.

How can I see that data using NSLog?

If anyone is not clear about my question, then can ask me again.


Solution

  • If you want to see an NSArray and NSDictionary and etc objects then you can directly print like NSLog(@"%@",object);

    If it is an user defined object then you need to display by calling with property (attribute).

    User defined object with name object and properties like

    NSString *property1;
    int property2;
    NSMutableArray *property3;
    

    Print them in the console as follows:

    NSLog(@"%@, %d, %@" object.property1,object.property2,object.property3);