私が試したのは:
- (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];
}];
...
}
問題はself.window
、私のNSOperation
サブクラスにアクセスできないことです。アラートコントローラーを提示する他の方法はありますか?