I am creating a game with Sprite Kit, and all of my game code runs through the update:
method of the SKScene
that is running. I do not create any other threads myself.
It is my understanding that the application delegate methods:
- (void)applicationWillResignActive:(UIApplication *)application
- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationWillEnterForeground:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
Run on the main thread.
If update:
is called on the main thread, can I be certain that if I make changes to member variables of the running SKScene
(when any of the delegate methods is called), that the update:
method will see the changes ?
Is it possible that any of the above delegate methods will execute while the update:
method is executing and vice-versa?
EDIT: Do the delegate methods and [SKScene update:] execute on the same (main) thread ?