我试图添加一个UIAlertController
到我的应用程序,但它并没有出现。我曾尝试以下内容:UIAlertController没有出现在所有
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Message" message:@"Web Service is not available." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:ok];
[self presentViewController:alertController animated:YES completion:nil];
但这并不出现,我做错了什么?
此代码应该正常工作。你能告诉我们这段代码出现的上下文的其余部分吗? – JaredH
你发布的代码看起来应该可以工作。你的方法看起来像你用来显示警报?该方法是否被调用? – Adrian
您是否试图将此警报控制器显示在主线程之外?你甚至是从视图控制器提出它?你有什么错误吗? – JAL