What I tried is:
- (void)main
{
NSError *err = (__bridge NSError *)error;
UIAlertController * alert = [UIAlertController
alertControllerWithTitle:NSLocalizedString(@"Error", nil)
message:err.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
//Do some thing here
[self.window.rootViewController dismissViewControllerAnimated:YES completion:nil];
}];
...
}
The problem is that there is no access to self.window
in my NSOperation
subclass.
Is there any other way to present alert controller?