UIAlertController在AppDelegate里面

UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"提示" message:payloadMsg preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:@"是" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

    }];
    UIAlertAction *archiveAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
             }];
    [alertController addAction:deleteAction];
    [alertController addAction:archiveAction];
    [self.window.rootViewController presentViewController:alertController animated:YES completion:nil];

你可能感兴趣的:(UIAlertController在AppDelegate里面)