How to access the game view controller on ios


I am not an ios developer, and I might get some terms wrong here.

I am trying to create an AlertViewController in an extension following this:

This line is the problem:

[self presentViewController:alert animated:YES completion:nil];

“self” refers to some ViewController I guess. But how do I get the View Controller of the Game in an ios extension?


This seems to work:

[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentModalViewController:alert animated:YES];