user1573321
user1573321

Reputation:

Sending 'NSTimeInterval' (aka 'double') to parameter of incompatible type 'id'

Getting this error, what does it mean here.

[mediaPlayTime setText:[NSString stringWithFormat:@"%@ / %@", [self formatTime:currentTime],[self formatTime:duration]]];

- (NSString*)formatTime:(float)time{
int minutes = time / 60;
int seconds = (int)time % 60;
return [NSString stringWithFormat:@"%@%d:%@%d", minutes / 10 ? [NSString stringWithFormat:@"%d", minutes / 10] : @"", minutes % 10, [NSString stringWithFormat:@"%d", seconds / 10], seconds % 10];
}

Upvotes: 0

Views: 3225

Answers (1)

user1573321
user1573321

Reputation:

In .h

  -(NSString*)formatTime:(float)time;

.m

  [mediaPlayTime setText:[NSString stringWithFormat:@"%@ / %@", [self formatTime:currentTime],[self formatTime:duration]]];



 - (NSString*)formatTime:(float)time{
int minutes = time / 60;
int seconds = (int)time % 60;
return [NSString stringWithFormat:@"%@%d:%@%d", minutes / 10 ? [NSString stringWithFormat:@"%d", minutes / 10] : @"", minutes % 10, [NSString stringWithFormat:@"%d", seconds / 10], seconds % 10];
}

just the minor changes solved the problem.

Upvotes: 2

Related Questions