Print NSString Argument using NSLog

37,949

Solution 1

NSLog(@"%@",msg); its of type NSString.

Solution 2

Using This

NSLog(@"Message == %@",msg);

Solution 3

You will like this:

#define CNMLog(msg) NSLog(@"%@", msg)
CNMLog(msg);
Share:
37,949
user559142
Author by

user559142

Updated on June 24, 2020

Comments

  • user559142
    user559142 almost 4 years
    -(void) postToDB:(NSString*) msg{
        //print msg
        NSString *myphp = @"/Applications/MAMP/htdocs/databases/test.php";
        NSURL *url = [NSURL URLWithString:myphp];
        ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
        [request setPostValue:msg forKey:@"message"];
    }
    

    In the above method, how can I print 'msg' using NSLog?

    Many thanks