【发布时间】:2011-06-03 07:00:21
【问题描述】:
我以为NSAssert 不能使用printf 说明符,但是这个:
NSAssert(0, @"%@%@", @"foo", @"bar");
按照您的预期工作:
*** Assertion failure in -[MyClass myMethod], <Path>/MyClass.m:84
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'foobar'
那么当NSAssert 起作用时,使用NSAssert1、NSAssert2 等有什么意义呢?
这与 Xcode 4.0 和 iOS 4.3 SDK,如果这很重要的话。 (如果没有,我会更新标签。)
【问题讨论】:
标签: cocoa-touch cocoa nsassert