8

stringWithFormat は文字列を返す必要があります。なぜこのステートメントはコンパイルされないのですか

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

いつ

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

コンパイルしますか?

4

2 に答える 2

17

これを次のように使用します。

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

お役に立てば幸いです。

于 2013-08-23T11:09:43.837 に答える