我能与iOS 8中得到的最接近的是通过设置标题的消息,而不是:但是
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location field required." message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

应该指出的是,UIAlertView
在iOS 8的弃用如果你打算使用iOS 7和iOS 8的单独代码路径,则应该使用UIAlertController
代替:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Location field required." message:nil preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self dismissViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alert animated:YES completion:nil];
我用两种方法都得到了相同的结果。