iOS and tvOS shares a lot of code. However some there are parts that are
specific to iOS, for instance handling of UI device orientation and
certain types of gestures.
Currently there are also some limitations on the Apple TV that needs to
be flagged to the engine. There is no support for virtual keyboard, no
clipboard support and no possibility to open URLs.
Put code specific for iOS within the ObjC platfrom macro TARGET_OS_IOS.
The code specific for tvOS are put within the macro TARGET_OS_TV.
This is better than using an hardcoded delay for two main reasons.
The first one is that the application can terminate as soon as it
has finished saving the state, and the second one is that it will
still work if saving the state takes longer than the delay that
was hardcoded.