objective-cnsstringnslog

Printing '%' in NSString formatting


I need some response like 100 % but unable to print % after the number, as it comes with warning incomplete Identifier. enter image description here

I have tried searching solutions, used \%, '%' but no help.


Solution

  • Escape the special % character using another % character:

    @"%2.0f%%"