0

This is the message in console

- (instancetype)initWithTitle:(NSString *)title
                  message:(NSString *)message
        cancelButtonTitle:(NSString *)cancelButtonTitle
        otherButtonTitles:(NSString *)otherButtonTitles, ...
{
if (self = [super initWithTitle:title message:message
                       delegate:delegate
              cancelButtonTitle:cancelButtonTitle
              otherButtonTitles:XXXX]) {
}
return self;
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
GeforceLee
  • 74
  • 5
  • I can not understand your question, can you please elaborate? – saurabh May 07 '15 at 04:10
  • 1
    You can't. There is no way to pass the variable arguments. It's a limitation of the C language. – rmaddy May 07 '15 at 05:10
  • BTW - see http://stackoverflow.com/questions/11518076/objective-c-invoke-a-method-with-variable-argument-list-ns-requires-nil-termi?lq=1 – rmaddy May 07 '15 at 05:14
  • I found the another way to solve http://stackoverflow.com/questions/2345196/objective-c-passing-around-nil-terminated-argument-lists?lq=1 – GeforceLee May 07 '15 at 05:41

1 Answers1

-1

Insert this before the super call, and use ap as the ... variable argument parameter.

va_list ap;
va_start(ap, otherButtonTitles);

// Replace your XXXX with ap

va_end(ap);
Schemetrical
  • 5,506
  • 2
  • 26
  • 43
  • @rmaddy [what says it wont work?](http://stackoverflow.com/questions/2391780/how-to-pass-variable-arguments-to-another-method) I've done it before. – Schemetrical May 07 '15 at 05:37
  • Let me clarify. Yes, you can pass `ap` if (and it's a big if), the other method has a parameter of type `va_list` (like in the last method of the answer you linked in your comment). But that's not the question. The question is how to pass the variable arguments from one method using the `...` syntax to another method also using the `...` syntax. That can't be done. You can't pass the `ap` in your answer to a method that has the `...` syntax. – rmaddy May 07 '15 at 05:41