basically i am making an app that pulls a number from online (using json) and what i want to know is how i can reload that data every 5 seconds or so. I have set it up so it is in a function called getData() and i thought making it in an infinite while loop would work like this:
while 1 > 0 {
getData()
sleep(5)
}
However, whenever i launch the app it crashes. (It works when i call getData() without the infinite loop) Am i missing something? How can i refresh my json data every 5 seconds? Thank You!