I have to make a simple task - singleview app with two buttons and three treads -
Start Button :
create a thread T1 - the GPS location of the device is collected r
In appendAndPost
, you are appending result only if the count is less than maxData
.
But let’s imagine that you called this where you already had five items in the array. In that scenario, you start the request, but you’re never doing anything with the supplied value.
I would advise appending the value regardless, and sending if the count
hits the threshold:
func appendAndPost(phoneInfo: String) {
data.append(phoneInfo)
if data.count >= maxData {
// create your request and send it
...
// reset `data`
data = []
}
}