I need a really modal alert, i.e., one which runs and allows the user interaction and closes and returns the selected option inside of a single method.
(I need to serve an API which calls my callback, presuming I show an alert, get the user's decision, and return it from that very callback. The callback comes in the main thread.)
What's the proper way to do this in i(Pad)OS 18+? Thanks!
For reference, up to 17, the following code worked nicely; in 18, it does not anymore:
volatile BOOL __block stillRuns=YES;
UIAlertController* ac=[UIAlertController alertControllerWith... preferredStyle:UIAlertControllerStyleAlert];
[ac addAction:[UIAlertAction actionWith... handler:^(UIAlertAction * _Nonnull action) {
stillRuns=NO;
}]];
...
[UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:ac animated:YES completion:nil];
while (stillRuns) [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:.1]];