I need to access keyWindow in share extension for my app to
- Add some indicator view
- Access the width and height of window
I wrote the following line in the share extension classes:
UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
But, it's saying 'sharedApplication' is unavailable.
How can i access keyWindow in share extension?
Need your valuable suggestions.
Thanks in advance
Shared Application is not available to extensions. You can not access key window from share extension.You can subclass ShareExtension View controller from UINavigationController and can present a modal view controller then navigation also possible. In that modal view controller you can add activity indicator.