At the end of Avengers: Endgame Tony Stark makes use of the Stones, taking a great amount of damage doing so. Is there a reason why Doctor Strange did not use the Time Stone to restore Tony in the same way he restored an apple?
A similar event happens during the course of Doctor Strange with the Ancient One. Just like Strange, she looks through time and sees countless possible futures with countless different events playing out, but cannot find any in which she survives her battle with Kaecilius.
I’ve spent so many years peering through time, looking at this exact moment. But I can’t see past it. I’ve prevented countless terrible futures. And after each one, there’s always another. And they all lead here, but never further.
To me, this would indicate that there are events which are, to put it simply, destined to happen, and cannot be undone even with the Time Stone. The Ancient One was always going to die in battle with Kaecilius, and Tony Stark was always going to die defeating Thanos. The Time Stone's exact workings are somewhat vague, but this aspect seems consistent.
The Russos answered this question previously and it is because any scenario where Tony is saved means Thanos will win in the long run, his death is a must. No mention is made of how Thanos would win if Tony is saved.
Q: In IW, Thanos used the time stone to reverse the time so he could the already dead Vision, and it didn’t cause any time parallax. Why did no one use time stone to save Iron Man’s life in EG?
A: It’s because even if you save Iron Man, it will still not change the fact that Thanos will eventually win the war. Among the 14 million possibilities that Doctor Strange has seen, Iron Man’s sacrifice is a must for that one win scenario.
Petersaber mentioned this in a comment, but I'd like to expand on it:
Reversing time to undo Tony's death would also undo the outcome of the event that led to his death—his Snap. In order to save Tony, you have to rewind to before he snapped, which puts Thanos and his whole army back, which ultimately solves nothing.
Remember how in Infinity War, when Wanda destroyed the Mind Stone, the explosion caused a massive shockwave that rattled all the trees in the area? When Thanos used the Time Stone to reverse that explosion, we saw the shock and the trees move in reverse. You can't undo one event without undoing the other stuff attached to it.