Objective C-unknown class method for selector -


i have class method

+ (nsstring *)calcremaingtimetodate:(nsdate *)startdate:(nsdate *)enddate;   - (void)calcremaingtime {     if (self.meeting.starttime) {         self.timetomeetingoutput.text:self startdate = [appcontext calcremaingtimetodate:self.meeting.starttime];         cgrect bound = [self.timetomeetingoutput.text boundingrectwithsize:cgsizemake(278.f, 16.f)                                                                    options:nsstringdrawinguseslinefragmentorigin                                                                 attributes:@{nsfontattributename: self.timetomeetingoutput.font}                                                                    context:nil];         self.timetomeetingwidth.constant = bound.size.width + 10.f;     } 

but getting error no known class method selector 'calcremaingtimetodate'. not getting error.anyone please me out.

in class method:

+ (nsstring *)calcremaingtimetodate:(nsdate *)startdate:(nsdate *)enddate; 

has 2 parameters, in code you're passing one:

[appcontext calcremaingtimetodate:self.meeting.starttime]; 

for reason, compiler not recognizing method. method should called this:

[appcontext calcremaingtimetodate:self.meeting.starttime :secondparam]; 

there problem in declaration of method, you've not specified method name part second parameter, method name should this:

+ (nsstring *)calcremaingtimefromdate:(nsdate *)startdate todate:(nsdate *)enddate; 

and should called like:

[appcontext calcremaingtimefromdate:self.meeting.starttime todate:secondparam]; 

also in code, self.timetomeetingoutput.text:self startdate seems in invalid syntax.


Comments