• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying multiple errors in NSOpenPanel beginSheetModalForWindow:completionHandler:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying multiple errors in NSOpenPanel beginSheetModalForWindow:completionHandler:


  • Subject: Re: Displaying multiple errors in NSOpenPanel beginSheetModalForWindow:completionHandler:
  • From: Steve Mills <email@hidden>
  • Date: Tue, 24 Feb 2015 12:48:28 -0600

On Feb 24, 2015, at 11:18:04, Kyle Sluder <email@hidden> 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@hidden)

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:

This email sent to email@hidden


References: 
 >Displaying multiple errors in NSOpenPanel beginSheetModalForWindow:completionHandler: (From: Steve Mills <email@hidden>)
 >Re: Displaying multiple errors in NSOpenPanel beginSheetModalForWindow:completionHandler: (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Convert CGFloat to NSNumber
  • Next by Date: Handle js cookies in WebView
  • Previous by thread: Re: Displaying multiple errors in NSOpenPanel beginSheetModalForWindow:completionHandler:
  • Next by thread: Convert CGFloat to NSNumber
  • Index(es):
    • Date
    • Thread