Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output NSString Type in NSLog Function in Objective-C?

Tags:

objective-c

I want a input from user their name and output that input name in NSLog using NSString. I don't know which % sign and how to output that. Can i use scanf() function for that? Please help me , i am just beginner of Objective-C.

like image 245
Fire Fist Avatar asked Nov 23 '11 14:11

Fire Fist


People also ask

How to print NSString value in Objective-C?

You can use %@ for all objects including NSString. This will in turn call the objects description method and print the appropriate string.

What is NSLog in Objective-C?

NSLog method in Objective-C prints out log messages.

How do I print text in Xcode?

In Swift with Xcode you can use either print() or NSLog() . print() just outputs your text.


1 Answers

You can use %@ for all objects including NSString. This will in turn call the objects description method and print the appropriate string. Most objects have a rather useful representation already there (e.g. NSArray objects return the descriptions of all their contents).

like image 167
Dennis Bliefernicht Avatar answered Dec 06 '22 21:12

Dennis Bliefernicht