NSNumber
4 つの異なる配列で s をフォーマットして、非常に長い文字列を作成しています。
NSString *datos = @"";
for (NSInteger counter = 0; counter < [latOut count]; counter++) {
datos = [datos stringByAppendingString:[NSString stringWithFormat:@"%.0005f,", [[latOut objectAtIndex:counter] floatValue]]];
datos = [datos stringByAppendingString:[NSString stringWithFormat:@"%.0005f,", [[lonOut objectAtIndex:counter] floatValue]]];
datos = [datos stringByAppendingString:[NSString stringWithFormat:@"%ld,", [[tipoOut objectAtIndex:counter] integerValue]]];
datos = [datos stringByAppendingString:[NSString stringWithFormat:@"%ld\n", [[velocidadOut objectAtIndex:counter] integerValue]]];
}
NSString *curDir = [[NSFileManager defaultManager] currentDirectoryPath];
NSString *path = @"";
path = [path stringByAppendingPathComponent:curDir];
path = [path stringByAppendingPathComponent:@"data.csv"];
// Y luego lo grabamos
[datos writeToFile:path atomically:YES encoding:NSASCIIStringEncoding error:&error];
カウントは 18,000 エントリで、このループが完了するまでに約 2 分かかります。
どうすればこれをもっと速くすることができますか?