Search code examples
iosobjective-cnsstringnslog

Objective C place NSString in NSLog


Really basic Obj C question:

before you say this is a duplicate I have already checked other answers and that is what I am using to do this with are saying to do it this way.

So I just want to output a NSString to NSLog but I am getting the error expected ")" on the log line.

I am obviously missing somthing really basic.

Here is the code:

//
//  HelloWoldOBJ.m
//  Helloworld2


#import "HelloWoldOBJ.h"

@implementation HelloWoldOBJ

    NSString *make = @"porche";

    NSLog(@"%@", make);

@end

Thanks for your help


Solution

  • call your string in viewDidLoad and check

     - (void)viewDidLoad
    
     {
    [super viewDidLoad];
    
    NSString *make = @"porche";
    
    NSLog(@"%@", make);
    
    
     }
    

    you get the out put like

    enter image description here