Note that there are some explanatory texts on larger screens.

plurals
  1. POreturning a stringfromdate method
    primarykey
    data
    text
    <p>So here's some code that I'm having trouble with:</p> <pre><code>//format the date to a string for echoing it NSDateFormatter* formattedDate = [[NSDateFormatter alloc] init]; [formattedDate setDateStyle:NSDateFormatterLongStyle]; //now myFormatted is set to a long style NSString* dateForOutput = [formattedDate stringFromDate:self.datePickerOutlet.date]; //also now need to set the "you began on" text to the newly chosen date [self.startDate setText:@"You started on: %@", dateForOutput]; </code></pre> <p>The error that is given is: "Too Many Arguments to method call, expected 1, have 2"</p> <p>I don't see why it's saying that I'm trying to pass in two methods. I tried to do the following in case I was being stupid but it still gave me an error:</p> <pre><code>//format the date to a string for echoing it NSDateFormatter* formattedDate = [[NSDateFormatter alloc] init]; [formattedDate setDateStyle:NSDateFormatterLongStyle]; //now myFormatted is set to a long style NSString* dateForOutput = [formattedDate stringFromDate:self.datePickerOutlet.date]; //also now need to set the "you began on" text to the newly chosen date NSString *foobar = @"You started on: %@", dateForOutput; [self.startDate setText:foobar]; </code></pre> <p>Error given: "Interface type cannot be statically allocated"</p> <p>Frankly I have no idea why it's giving me this error... some help would be greatly appreciated. It's probably just something small that I'm just not seeing for some reason =/</p> <p>cheers, Matt</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload