NSAssert를 사용하여 


#define NSAssert(condition, desc, ...) \

    do { \

__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \

if (!(condition)) { \

    [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \

object:self file:[NSString stringWithUTF8String:__FILE__] \

    lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \

} \

        __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \

    } while(0)

#endif


-(void) method:(id)sender

{

    // Make sure sender is actually of the right class.

    NSAssert([sender isKindOfClass:[MyClass class]], @"sender is not a MyClass!");

MyClass* myClass = (MyClass*)sender;


}




코드가 곧 설명


Posted by KraZYeom

댓글을 달아 주세요