I need to be able to set the system time on the simulator when I do unit/ui tests in XCode. I tried doing “sudo date 0410125516” in a script step in my workflow, but doing so messed up the run timer: “Invalid time box size for RunTime: -28782392495010873”
Although you are able to change the system time, but you should never do that. It will cause lots of trouble, will make it pretty much impossible to run it locally on your Mac/PC and web services tend to reject upload & download requests when the time is not in sync.
You should either:
- Make your tests to not to depend on the time.
- Or make your tests to “mock” / set / simulate the time you want. Something like this: http://stackoverflow.com/questions/29889246/how-to-mock-nsdate-in-swift
If you have any questions, just let us know!