I have the following code in my app, which iterates over an array of objects to find the max value of one of the fields:
var high: Float = 0
let readings: [Reading] = test.readings
for i in 0 ... readings.count {
let load = readings[i].loadReading
if load != nil{
if load > high{
high = load!
}
}
}
This code works fine in debug mode, but invariably crashes in release mode. The values have all been used previously in the loop, and produce the correct effects. test.readings is optional, but the code will not progress to this loop if it is. Has anyone got any ideas about what may change between debug and release mode that will cause this?