On Feb 24, 2015, at 11:18:04, Kyle Sluder <[email protected]> wrote:
>
> This sounds like the kind of thing -[NSDocument
> performActivityWithSynchronousWaiting:usingBlock:] was designed for,
> though it's a rather tricky API. Here's my stab at it:
Interesting stuff, and highly confusing. :)
> - (IBAction)showMyOpenPanel:(id)sender {
> NSOpenPanel *op = /* ... */
> [self performActivityWithSynchronousWaiting:YES usingBlock:^{
> [op beginSheetModalForWindow:self.window completionHandler:^{
> __block BOOL didSuppress = NO;
> for (NSURL *url in op.selectedURLs) {
> if ( ProcessURL(url) == kSomethingBadHappened ) {
> [self performActivityWithSynchronousWaiting:NO usingBlock:{
> if (didSuppress)
> return;
> else {
> [self continueAsynchronousActivityUsingBlock:^{
> NSAlert *alert = /* ... */
> [alert beginSheetModalForWindow:self.window
> completionHandler:^{
> if (alert.suppressionButton.state == NSOnState)
> didSuppress = YES;
> }];
> }];
> }
> }];
> } // end kSomethingBadHappened
> }
> }]; // end beginSheetModalForWindow
> }]; // end performActivityWithSynchronousWaiting
> }
continueAsynchronousActivityUsingBlock doesn't exist. Did you mean
continueAsynchronousWorkOnMainThreadUsingBlock or continueActivityUsingBlock?
I've tried both and it's not working. I also needed to fill in the
completionHandler parameter portion of the two calls to
performActivityWithSynchronousWaiting, and I'm calling those completion
handlers at the end of their respective blocks, although I'm not clear on where
the source of those handlers comes from.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]