Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does not this NSAssert with stringWithFormat compile?

Tags:

ios

nsassert

stringWithFormat should return a string, why does this statement not compile

NSAssert(YES, [NSString stringWithFormat:@"%@",@"test if compiles"]);

when

NSAssert(YES, @"test if compiles");

compiles?

like image 901
bogen Avatar asked Aug 23 '13 11:08

bogen


1 Answers

Use this as :

NSAssert(YES, ([NSString stringWithFormat:@"%@",@"test if compiles"])); // Pass it in brackets ()

Hope it helps you.

like image 144
Nishant Tyagi Avatar answered Sep 18 '22 18:09

Nishant Tyagi