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

  • Home
  • SEARCH
  • 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 8642921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:54:10+00:00 2026-06-12T11:54:10+00:00

Possible Duplicate: How to write a method/message with multiple parameters? I am really confused

  • 0

Possible Duplicate:
How to write a method/message with multiple parameters?

I am really confused here… I have looked at SO and Google where I found an example of calling a method with two parameters. So I modified it for my use, and unfortunately I can’t get it to work. Here is my updated code:

-  definition of method
- (NSArray *) fetchEventsBetweenDates: (NSDate *) sDate: andDate: (NSDate *) eDate;

- definitions and creation of sD and eD
    //  convert start dates to NSDate
    NSDateFormatter* df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"MM/dd/yyyy"];
    NSDate* sD = [df dateFromString:@"10/03/2012"];
    NSLog(@"startDate: %@", sD);

    //  convert end dates to NSDate
    NSDate* eD = [df dateFromString:@"10/05/2012"];
    NSLog(@"endDate: %@", eD);

- call to method
    [self.eventsList addObjectsFromArray:[self fetchEventsBetweenDates: sD andDate: eD]];

- method
- (NSArray *) fetchEventsBetweenDates: (NSDate *) sDate: andDate: (NSDate *) eDate  {

I have tried every permutation I think was reasonable, and it still will not build. I am getting a “expected ‘:’ on the call to the method.

What am I doing wrong?

  • 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-12T11:54:12+00:00Added an answer on June 12, 2026 at 11:54 am

    Please read The Objective-C Programming Language from Apple. Specifically the Message Syntax part.

    The message declaration syntax is like this:

    - (return type)myMethodParam1:(param1 type)p1 param2:(param2 type)p2;
    

    Example:

    - (NSArray *)fetchEventsBetweenDate:(NSDate *)startDate andDate:(NSDate *)endDate;
    

    The implementation is the same, you just replace the semicolon ; with the implementation in curly brackets { implementation }.

    When calling a method, you replace the parameter declarations with your variables:

    // Assuming aDate and otherDate exist.
    [self fetchEventsBetweenDate:aDate andDate:otherDate];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Java GUI repaint() problem? I write a Java code, but I have
Possible Duplicate: Is it possible to write swap method in Java? Given two values
Possible Duplicate: How to mock a method that returns an int with MOQ Here's
Possible Duplicate: Does std::list::remove method call destructor of each removed element? I have a
Possible Duplicate: Intercept object on method invocation with Mockito I have an class that
Possible Duplicate: how to write in stdout after to call a method (doing a
Possible Duplicate: Efficient Method for Creating CSV String from Lists/SortedLists C#? Here i need
Possible Duplicate: Replace multiple whitespaces with single whitespace in JavaScript string I have used
Possible Duplicate: When should I write the keyword 'inline' for a function/method? I am
Possible Duplicate: Autocomplete method structure in Vim So I have smart autocomplete features on

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.