Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8241317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:47:47+00:00 2026-06-07T20:47:47+00:00

I need to receive more than one variable Args in my method. But I

  • 0

I need to receive more than one variable Args in my method. But I don’t know how to do so.

For example:

(void)insertInTableOnAttributes:(id)fieldsNames, ... Values:(id)fieldsValues, ...;

sadly it appears a compiler error after the first (...) saying:

Expected ':' after method Prototype".

And in the implementation says:

Expected Method Body" in the same position (just after the first ...)

PD: I’m using Xcode 4.2.1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:47:49+00:00Added an answer on June 7, 2026 at 8:47 pm

    You can’t do that. How would the generated code possibly know where one argument list ends and the next begins? Try to think of the C equivalent

    void insertInTableOnAtributes(id fieldNames, ..., id fieldValues, ...);
    

    The compiler will reject that for the same reason.

    You have two reasonable options. The first is to provide a method that takes NSArrays instead.

    - (void)insertInTableOnAttributes:(NSArray *)fieldNames values:(NSArray *)fieldValues;
    

    The second is to use one varargs with a name-value pair, similar to +[NSDictionary dictionaryWithObjectsAndKeys:]

    - (void)insertInTableOnAttributes:(id)fieldName, ...;
    

    This one would be used like

    [obj insertInTableOnAttributes:@"firstName", @"firstValue", @"secondName", @"secondValue", nil];
    

    The C analogy is actually quite accurate. An Obj-C method is basically syntactic sugar on top of a C method, so

    - (void)foo:(int)x bar:(NSString *)y;
    

    is backed by a C method that looks like

    void foobar(id self, SEL _cmd, int x, NSString *y);
    

    except it doesn’t actually have a real name. This C function is called the IMP of the method, and you can retrieve it using obj-c runtime methods.

    In your case of having arguments after a varargs, your

    - (void)someMethodWithArgs:(id)anArg, ... andMore:(id)somethingElse;
    

    would be backed by an IMP that looks like

    void someMethodWithArgsAndMore(id anArg, ..., id somethingElse);
    

    and since you cannot have any arguments after a varargs, this simply won’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need more than one email account to receive an email of a new
I receive more than 1 million rows per hour, I need a way to
When I call fetch(), I receive more than one models @ client side. At
I need to receive a GTK+ focus in event on a Terminal (VTE), but
I have one tcp client that need read data via tcp but i need
i want to find out if the user is currently using more than one
in my application i have a server that listen in more than one udp
because I need to display something more than just a list in a Fragment.
Having more than one process read from a serial device (/dev/ttyXX) makes it so
I am looking for design guidance here more than actual solutions, but welcome both.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.