그래서 나는 그것을 해결했습니다 - 내 문제는 nsnumbers로 수학을 올바르게하는 방법을 몰랐다는 것입니다. 나는 그것을 찾고 있다는 것을 몰랐습니다. 그래서 나는 그것을 요구하지 않았습니다. 다음은 장치에서 앨범의 길이를 계산하기 위해 제시 한 코드입니다.
- (void)fullAlbumLength
{
for (int i=0; i < songsAlbumList.count; i++)
{
if (addLength == NULL) // addLength and addLengthNew are NSNumber variables
{
addLength = [[self.albumTracksList objectAtIndex:i] valueForProperty: @"playbackDuration"];
}
else
{
addLengthNew = [[self.albumTracksList objectAtIndex:i] valueForProperty: @"playbackDuration"];
addLength = [NSNumber numberWithFloat:([addLength floatValue] + [addLengthNew floatValue])];
}
}
fullminutes = floor([addLength floatValue] / 60); // fullminutes is an int
fullseconds = trunc([addLength floatValue] - fullminutes * 60); // fullseconds is an int
fullLength.text = [NSString stringWithFormat:@"%02d:%02d", fullminutes, fullseconds];
}
이것이 다른 사람에게 도움이되기를 바랍니다.