appendFormat:
を内部的に使用するNSMutableStringに対してカテゴリを作成しています。パラメータ数が不明なObjective-cメソッド
@interface NSMutableString (Additions)
- (void)appendFormatWithLine:(NSString *)format, ...;
@end
@implementation NSMutableString (Additions)
- (void)appendFormatWithLine:(NSString *)format, ... {
va_list args;
va_start(args, format);
// **calling [self appendFormat] gives a 'EXC_BAD_ACCESS'**
[self appendFormat:format, args];
[self appendString:@"\r\n"];
va_end(args);
}
@end
私はNSMutableString:appendFormat
を呼び出すためにva_listのか、va_startマクロを使用する方法は考えています。これはどうすればできますか?
この質問にこの答えを便利かもしれませんします。http: //stackoverflow.com/questions/2137752/objective-c-va-list-and-selectors –