gpt4 book ai didi

iphone - 将 'NSTimeInterval'(aka 'double')发送到不兼容类型 'id'的参数

转载 作者:行者123 更新时间:2023-12-02 10:45:37 25 4
gpt4 key购买 nike

收到此错误,这意味着什么。

[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];
}

最佳答案

在.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];
}

只需很小的更改就可以解决问题。

关于iphone - 将 'NSTimeInterval'(aka 'double')发送到不兼容类型 'id'的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13029546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com